解決済み

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.

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

Count photos

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前

解決済み

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

3ヶ月 前