Risolto

Find the numeric mean of the prime numbers in a matrix.
There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

oltre 10 anni fa

Risolto

Sum the entries of each column of a matrix which satisfy a logical condition.
Given a numeric matrix A and a logical array L of the same size as A, return a row vector S containing the columnwise sums of th...

oltre 10 anni fa

Risolto

Cell joiner
You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

oltre 10 anni fa

Risolto

Back to basics 9 - Indexed References
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

oltre 10 anni fa

Risolto

Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

oltre 10 anni fa

Risolto

Replace all zeros and NaNs in a matrix with the string 'error'
Given a numeric input matrix A, possibly containing some zero values and some NaNs, replace any occurrences of zero or NaN with ...

oltre 10 anni fa

Risolto

Replicate elements in vectors
Replicate each element of a row vector (with NaN) a constant number of times. Examples : n=2, A=[1 2 3] -> [1 1 2 2 3 3] n=0...

oltre 10 anni fa

Risolto

Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...

oltre 10 anni fa

Risolto

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

oltre 10 anni fa

Risolto

Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

oltre 10 anni fa

Risolto

Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

oltre 10 anni fa

Risolto

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

oltre 10 anni fa

Risolto

Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

oltre 10 anni fa

Risolto

Is my wife right?
Regardless of input, output the string 'yes'.

oltre 10 anni fa

Risolto

Are all the three given point in the same line?
In this problem the input is the coordinate of the three points in a XY plane? P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) how can...

oltre 10 anni fa

Risolto

Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

oltre 10 anni fa

Risolto

Change a specific color in an image
The ability to change colors can be a useful tool in image processing. Given an m x n x 3 array (much like CData in images), fin...

oltre 10 anni fa

Risolto

Back and Forth Rows
Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

oltre 10 anni fa

Risolto

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

oltre 10 anni fa

Risolto

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

oltre 10 anni fa

Risolto

Getting the indices from a matrice
Getting the indices from a matrice. Inspired by Problem 645. Getting the indices from a vector by the great Doug Hull. Given a...

oltre 10 anni fa

Risolto

Fill a zeros matrix
The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

oltre 10 anni fa

Risolto

Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

oltre 10 anni fa

Risolto

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

oltre 10 anni fa

Risposto
total number of elements which are not zero
Hi, what about: B = sum(Percey~=0,2); Regards, W.

oltre 10 anni fa | 0

| accettato

Problema

Index of neighbor pixel with steepest gradient
Unlike in various applications, where the gradient of a two dimensional matrix is calculated in x and y direction, the gradient ...

oltre 10 anni fa | 2 | 20 risolutori

Risposto
How can I perform a comparison function (of surrounding pixels) on a DEM using a starting pixel?
Hi, you might be interested in using the function ixneighbors available on the FEX which might make life a little easier for ...

oltre 10 anni fa | 0

Risolto

Bullseye Matrix
Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

oltre 10 anni fa

Risolto

Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

oltre 10 anni fa

Risolto

Compute the dilation of a binary image
A basic operation in image analysis is the dilation. Given an image where each pixel is either on or off (black/white, true/fals...

oltre 10 anni fa