Solved

Convert matrix to 3D array of triangular matrices

Given a 2D numeric array x in which each column represents the vectorized form of an upper triangular matrix, return a 3D array ...

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

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

3 months ago

Solved

Remove entire row and column in the matrix containing the input values

Remove the entire row and column from the matrix containing specific values. The specified value can be a scalar or a vector. Fo...

3 months ago

Solved

What is the next step in Conway's Life?

Given a matrix A that represents the state of <http://en.wikipedia.org/wiki/Conway's_Game_of_Life Conway's game of Life> at one ...

3 months ago

Solved

Game of life - 01

Refer to <https://en.wikipedia.org/wiki/Conway's_Game_of_Life> given a set of cells (the initial state) represented by 1(l...

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

3 months ago

Solved

MatCAT - Reconstruct X from Its X-rays

Consider a matrix x x = [ 1 2 0 0 5 0 3 0 8 ] If we sum x along the rows we get row_sums = [3 5 11] ...

3 months ago

Solved

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

3 months ago

Solved

Get all prime factors

List the prime factors for the input number, in decreasing order. List each factor. If the prime factor occurs twice, list it as...

3 months ago

Solved

prime to each other

Given two integers n1, n2 greater than 1, find out if they have common divisors or are prime to each other. Return "true" if the...

3 months ago

Solved

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 months ago

Solved

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

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

3 months ago

Solved

Read a Soroban Abacus

*Description* The Soroban is the name of the modern Japanese abacus. Information on reading a Soroban can be found <http://we...

3 months ago

Solved

Convert a numerical matrix into a cell array of strings

Given a numerical matrix, output a *cell array of string*. For example: if input = 1:3 output is {'1','2','3'} whic...

3 months ago

Solved

Create a cell array out of a struct

Create a cell array out of a (single) struct with the fieldname in the first column and the value in the second column: in: ...

3 months ago

Solved

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

3 months ago

Solved

Find the maximum number of decimal places in a set of numbers

Given a vector or matrix of values, calculate the maximum number of decimal places within the input. Trailing zeros do not coun...

3 months ago

Solved

Make roundn function

Make roundn function using round. x=0.55555 y=function(x,1) y=1 y=function(x,2) y=0.6 y=function(x,3) ...

3 months ago

Solved

Rounding off numbers to n decimals

Inspired by a mistake in one of the problems I created, I created this problem where you have to round off a floating point numb...

3 months ago

Solved

Matlab Basics - Rounding III

Write a script to round a large number to the nearest 10,000 e.g. x = 12,358,466,243 --> y = 12,358,470,000

3 months ago

Solved

Matlab Basics - Rounding II

Write a script to round a variable x to 3 decimal places: e.g. x = 2.3456 --> y = 2.346

3 months ago

Solved

Check that number is whole number

Check that number is whole number Say x=15, then answer is 1. x=15.2 , then answer is 0. http://en.wikipedia.org/wiki/Whole_numb...

3 months ago

Solved

MATLAB Basic: rounding IV

Do rounding towards plus infinity. Example: -8.8, answer -8 +8.1 answer 9 +8.50 answer 9

3 months ago

Solved

MATLAB Basic: rounding III

Do rounding towards minus infinity. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 8

3 months ago

Solved

MATLAB Basic: rounding II

Do rounding nearest integer. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 9

3 months ago