Solved

Must be in the front row...

You are given a matrix followed by a single number. Your object is to write a script that will shift the matrix around so that ...

2 months ago

Solved

Go to the head of the class!

You're given a matrix and a single number. If that number is in the matrix, reorder the matrix so that number is in the first r...

2 months ago

Solved

Replace Nonzero Numbers with 1

Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

2 months ago

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.

2 months ago

Solved

Enlarge array

Given an m-by-n numeric array (A) and a 1-by-2 vector (sz) indicating the dimensions [p q] to enlarge each element, return an (m...

2 months ago

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

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

2 months ago

Solved

Magnet and Iron

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

2 months ago

Answered

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

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

2 months ago | 1

Answered

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

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

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

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

2 months 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'...

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

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

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

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

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

2 months ago

Answered

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

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

2 months ago | 1

| accepted

Answered

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

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

2 months 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 [...

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

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

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

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

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

2 months ago

Answered

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

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

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

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

2 months ago