Solved

Prime factor digits

Consider the following number system. Calculate the prime factorization for each number n, then represent the prime factors in a...

7 months ago

Solved

Proper Factors

Generate the proper factors of input integer _x_ and return them in ascending order. For more information on proper factors, ref...

7 months ago

Solved

Multiply 2 numbers

Very easy, you just have to multiply 2 numbers but you cannot use the following signs (*, /, - ,^) ,mtimes , times, cross, pro...

7 months ago

Solved

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

7 months ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

7 months ago

Solved

Return elements unique to either input

Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

7 months ago

Solved

Piecewise linear interpolation

Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...

7 months ago

Solved

Longest run of consecutive numbers

Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

7 months ago

Solved

Natural numbers in string form

Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be. Ex...

7 months ago

Solved

Fix the last element of a cell array

Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

7 months ago

Solved

String Array Basics, Part 3: Convert Cell Array with Missing Values to String Array

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

7 months ago

Solved

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

7 months ago

Solved

String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

7 months ago

Solved

Remove element(s) from cell array

You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

7 months ago

Solved

Create a cell array out of a struct

Create a cell array out of a (single) struct with the fieldname in the first column and the value in the second column: in: ...

7 months ago

Solved

Convert a Cell Array into an Array

Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

7 months ago

Solved

Sum of diagonal of a square matrix

If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

7 months ago

Solved

Trimming Spaces

Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

7 months ago

Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

7 months ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

7 months ago

Solved

Back to basics 22 - Rotate a matrix

Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

7 months ago

Solved

Making change

Given an amount of currency, return a vector of this form: [100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01] Example: Input a = ...

7 months ago

Solved

Summation of array

Given an array, Find the sum of all of the elements in it Examples: Input x = [1 2 3 5; 4 5 6 7]; Output y is 33

7 months ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

7 months ago

Solved

Remove NaN ?

input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

7 months ago

Solved

Remove the air bubbles

Given a matrix a, return a matrix b in which all the zeros have "bubbled" to the top. That is, any zeros in a given column shoul...

7 months ago

Solved

Matrix to column conversion

Given a matrix of any size, convert it into a column vector. e.g A=[10 20 30; 40 50 60] then, B = [10; 40; ...

7 months ago

Solved

Pangrams!

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

7 months ago

Solved

Return a list sorted by number of occurrences

Given a vector x, return a vector y of the unique values in x sorted by the number of occurrences in x. Ties are resolved by a ...

7 months ago

Solved

Create an n-by-n null matrix and fill with ones certain positions

The positions will be indicated by a z-by-2 matrix. Each row in this z-by-2 matrix will have the row and column in which a 1 has...

8 months ago