Solved

matrix zigzag
Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix [ 1 2 3 ; 4 5 6 ; 7 8 9 ] the resulting 1-...

26 días ago

Solved

Write a function man that takes a row vector v and returns a matrix H as follows..
Write a function called man that takes a row vector v as an input and returns a matrix H whose first column consist of the eleme...

26 días ago

Solved

Magnet and Iron
(Inspired from <http://www.mathworks.com/matlabcentral/cody/problems/112 Problem 112: Remove the air bubbles>) Iron (atomic n...

26 días ago

How to show first value on axis cuted with xlim?
Sorry, that's my fault. In that case you'll need to change the tick locations - see the below for more information. https://uk...

26 días ago | 1

How to show first value on axis cuted with xlim?
I just tried your way and I am getting the zero showing up on the x-axis so I'm not sure what is going on there. As an alternat...

26 días ago | 1

Solved

Given a 4x4 matrix, swap the two middle 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...

27 días ago

Solved

A matrix of extroverts
Now that the introverts have had their script, the extroverts spoke up (naturally!) and demanded one as well. You will be given...

27 días ago

Solved

frame of the matrix
Given the matrix M, return M without the external frame.

27 días ago

Solved

Too Many Zeros, Dump Them!
Sometimes when I create a matrix, I use this syntax: a = zeros(1000,1000); But when the function ends, I find that I don'...

27 días ago

Solved

Reference Index Number
Given a reference set R of elements (each unique but identical in type), and a list V of elements drawn from the set R, possibly...

27 días ago

Solved

Minimum of each diagonal
The well-known <http://www.mathworks.com/help/matlab/ref/min.html min> function can operate along either the rows or the columns...

alrededor de 1 mes ago

Solved

Maximum of each diagonal
The well-known <http://www.mathworks.com/help/matlab/ref/max.html max> function can operate along either the rows or the columns...

alrededor de 1 mes ago

Solved

Back to basics 20 - singleton dimensions
Covering some basic topics I haven't seen elsewhere on Cody. Remove the singleton dimensions from the input variable (e.g. if...

alrededor de 1 mes ago

Solved

Back to basics 13 - Input variables
Covering some basic topics I haven't seen elsewhere on Cody. Return as a string the name of the input variable to the functio...

alrededor de 1 mes ago

Brace indexing is not supported for variables of this type
I think Walter was onto the right thing in his comment. new_precipitation is of type 'double' and so doesn't support brace (i.e....

alrededor de 1 mes ago | 1

| accepted

Adjust z-axis location for a pcolor() plot
Okay, so just in case anybody has been looking here anticipating an answer and been disappointed. I have managed to figure this ...

alrededor de 1 mes ago | 0

| accepted

Solved

Create an index-powered vector
Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

alrededor de 1 mes ago

Solved

Oh Zero Zero Zero!!!
Hello all, So you have to find the largest section of zeros in a vector and then find the length of those zeros and there start...

alrededor de 1 mes ago

Solved

The sliding puzzle: 3D
This is an extension of <https://www.mathworks.com/matlabcentral/cody/problems/42842 problem 42842>. In this case, the puzzle is...

alrededor de 1 mes ago

Solved

Decimation - Optimized for speed
This problem is similar to http://www.mathworks.com/matlabcentral/cody/problems/1092-decimation, only this time the score will b...

alrededor de 1 mes ago

Solved

Count consecutive 0's in between values of 1
So you have some vector that contains 1's and 0's, and the goal is to return a vector that gives the number of 0's between each ...

alrededor de 1 mes ago

Solved

Find last zero for each column
Given a numeric array of arbitrary size, return the row index of the last zero for each column. If a column contains all nonzero...

alrededor de 1 mes ago

How to solve Iteration Equation ?
You just need to choose how many iterations you want to do, for example: n = 1; You then need an initial value to feed into th...

alrededor de 1 mes ago | 0

Solved

Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
For a row vector: V=[7 1 2 -3] there is one sign change (from 2 to -3). So, the function you write must return N=1. F...

alrededor de 1 mes ago

Solved

Implement a bubble sort technique and output the number of swaps required
A bubble sort technique compares adjacent items and swaps them if they are in the wrong order. This is done recursively until al...

alrededor de 1 mes ago

Solved

Decimation
When dealing to the Roman Army, the term decimate meant that the entire unit would be broken up into groups of ten soldiers, and...

alrededor de 1 mes ago

Solved

Create a vector whose elements depend on the previous element
The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

alrededor de 1 mes ago

Solved

Finding peaks
Find the peak values in the signal. The peak value is defined as the local maxima. For example, x= [1 12 3 2 7 0 3 1 19 7]; ...

alrededor de 1 mes ago

Solved

Find nth maximum
Find nth maximum in a vector of integer numbers. Return NaN if no such number exists. x = [2 6 4 9 -10 3 1 5 -10]; So ...

alrededor de 1 mes ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

alrededor de 1 mes ago