Solved

subtract central cross

Given an n-by-n square matrix, where n is an odd number, return the matrix without the central row and the central column.

10 months ago

Solved

Given a matrix, swap the 2nd & 3rd columns

If a = [1 2 3 4; 1 2 3 4; 1 2 3 4; 1 2 3 4]; then the result is ans = 1 3 2 4 1 3 2...

10 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. ...

10 months ago

Solved

Pernicious Anniversary Problem

Since Cody is 5 years old, it's pernicious. A <http://rosettacode.org/wiki/Pernicious_numbers Pernicious number> is an integer w...

10 months ago

Solved

Rotate input square matrix 90 degrees CCW without rot90

Rotate input matrix (which will be square) 90 degrees counter-clockwise without using rot90,flipud,fliplr, or flipdim (or eval)....

10 months ago

Solved

Matrix with different incremental runs

Given a vector of positive integers a = [ 3 2 4 ]; create the matrix where the *i* th column contains the vector *1:a(i)...

10 months ago

Solved

surrounded matrix

With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones: A = [1 2 ...

10 months ago

Solved

Permute diagonal and antidiagonal

Permute diagonal and antidiagonal For example [1 2 3;4 5 6;7 8 9] -> [3 2 1;4 5 6;9 8 7] WITHOUT diag function (and variable n...

10 months ago

Solved

Flip the main diagonal of a matrix

Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

10 months ago

Solved

Make an awesome ramp for a tiny motorcycle stuntman

Okay, given a vector, say v=[1 3 6 9 11], turn it into a matrix 'ramp' like so: m=[1 3 6 9 11; 3 6 9 11 0; 6 9 ...

10 months ago

Solved

Back to basics 23 - Triangular matrix

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

10 months ago

Solved

Back to basics 21 - Matrix replicating

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

10 months ago

Solved

Toolbox check part 3

In my ongoing quest to highlight obscure parts of MATLAB, the latest challenge is to take 2 string inputs, one a MATLAB toolbox ...

10 months ago

Solved

Specific toolboxes

Given a string that is the name of a MATLAB toolbox, return true if it is available on the Cody solvers evaluation system, false...

10 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...

10 months ago

Solved

Back to basics 3 - Temp Directory

Covering some basic topics I haven't seen elsewhere on Cody. Return a string that is the path to the system's current temp di...

10 months ago

Solved

Vector with a repeated entry

Create a row vector of length n, filled with 4's. For example, if n = 3, output = [4 4 4] Hint: Search for the function...

10 months ago

Solved

Area of a circle

Given the radius x, y would be the area of a circle. Pi = 3.1416

10 months ago

Solved

Compare two input matrices

Check which input matrix has more elements. Return "1" if matrix A has more elements than matrix B. Otherwise return "0". Exa...

10 months ago

Solved

Remove any row in which a NaN appears

Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

10 months ago

Solved

Count photos

Given n people, everyone must have pictures taken with everyone, each photo includes only two persons, please count the total nu...

10 months ago

Solved

Divide by 4

Given the variable x as your input, divide it by 4 and put the result in y.

10 months ago

Solved

Create a vector of the first n natural numbers (★)

If n = 7, your program should return a vector y, where y = [1 2 3 4 5 6 7].

10 months ago

Solved

Doubling elements in a vector (★★)

(copy of prob. 1024) Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] t...

10 months ago

Solved

Vector raised to a power, element-wise (★)

Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

10 months ago

Solved

Sum of elements in a vector (★)

(copy of Prob. 3) Find the sum of all the numbers of the input vector x. Input x = [1 2 3 5] Output y is 11 <> ...

10 months ago