A résolu

Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

plus de 10 ans il y a

A résolu

Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

plus de 10 ans il y a

A résolu

Back to basics 25 - Valid variable names
Covering some basic topics I haven't seen elsewhere on Cody. Given a string, return true if it is a valid MATLAB variable nam...

plus de 10 ans il y a

A résolu

Create a square matrix of multiples
Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row. This also applies...

plus de 10 ans il y a

A résolu

matrix of natural number
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 resides seially as shown in the examples below. ...

plus de 10 ans il y a

A résolu

Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

plus de 10 ans il y a

A résolu

Implement simple rotation cypher
If given a letter from the set: [abc...xyz] and a shift, implement a shift cypher. Example: 'abc' with a shi...

plus de 10 ans il y a

A résolu

Number of Horns on a unicorn!
Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

plus de 10 ans il y a

A résolu

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

plus de 10 ans il y a

A résolu

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

plus de 10 ans il y a

A résolu

Set the array elements whose value is 13 to 0
Input A either an array or a vector (which can be empty) Output B will be the same size as A . All elements of A equal to 13...

plus de 10 ans il y a

A résolu

Find the largest value in the 3D matrix
Given a 3D matrix, A, find the largest value. E.g. >> A = 1:9; >> A=reshape(A,[3 1 3]); >> islargest(A) ans = 9

plus de 10 ans il y a

A résolu

Compute a dot product of two vectors x and y
x and y are input vectors, d is a number and contains their dot product

plus de 10 ans il y a

A résolu

Multiply a column by a row
* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...

plus de 10 ans il y a

A résolu

Whether the input is vector?
Given the input x, return 1 if x is vector or else 0.

plus de 10 ans il y a

A résolu

Given a window, how many subsets of a vector sum positive
Given a vector: [1 0 -1 3 2 -3 1] and a window of 2, A sliding window would find: 1 + 0 = 1 0 - 1 = -1 ...

plus de 10 ans il y a

A résolu

Get the length of a given vector
Given a vector x, the output y should equal the length of x.

plus de 10 ans il y a

A résolu

Determine Whether an array is empty
Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

plus de 10 ans il y a

A résolu

Angle between two vectors
You have two vectors , determine the angle between these two vectors For example: u = [0 0 1]; v = [1 0 0]; The a...

presque 11 ans il y a

A résolu

Convert a vector into a number
This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

environ 11 ans il y a

A résolu

Replace May with April
For instance, if the input is input_str = 'The flowers may bloom in April'; then the output is output_str = 'The flo...

environ 11 ans il y a

A résolu

Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

environ 11 ans il y a

A résolu

Arrange vector in ascending order
Arrange a given vector in ascending order. input = [4 5 1 2 9]; output = [1 2 4 5 9];

environ 11 ans il y a

A résolu

Find number of days
The input is two date in string format (dd-mm-yyyy) find out the number of days between these two dates. Example: input: ...

environ 11 ans il y a

A résolu

Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

environ 11 ans il y a

A résolu

Return the first and last character of a string
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

environ 11 ans il y a

A résolu

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

environ 11 ans il y a

A résolu

Scoring for oriented dominoes
Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...

environ 11 ans il y a

A résolu

Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

environ 11 ans il y a

A résolu

Sorting
Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column. Exa...

environ 11 ans il y a