Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
input = 1:3;
output = {'1' '2' '3'};
assert(isequal(matrix2cell(input ),output))
assert(iscell(output),'output must be a cell')
c =
1×3 cell array
{[1]} {[2]} {[3]}
c =
1×3 cell array
{'1'} {[2]} {[3]}
c =
1×3 cell array
{'1'} {'2'} {[3]}
c =
1×3 cell array
{'1'} {'2'} {'3'}
|
2 | Pass |
input = 0:5:8
output = {'0' '5'};
assert(isequal(matrix2cell(input ),output))
assert(iscell(output),'output must be a cell')
input =
0 5
c =
1×2 cell array
{[0]} {[5]}
c =
1×2 cell array
{'0'} {[5]}
c =
1×2 cell array
{'0'} {'5'}
|
3 | Pass |
input =magic(3);
output = {'8' '1' '6'
'3' '5' '7'
'4' '9' '2'}
assert(isequal(matrix2cell(input ),output))
output =
3×3 cell array
{'8'} {'1'} {'6'}
{'3'} {'5'} {'7'}
{'4'} {'9'} {'2'}
c =
3×3 cell array
{[8]} {[1]} {[6]}
{[3]} {[5]} {[7]}
{[4]} {[9]} {[2]}
c =
3×3 cell array
{'8'} {[1]} {[6]}
{[3]} {[5]} {[7]}
{[4]} {[9]} {[2]}
c =
3×3 cell array
{'8'} {[1]} {[6]}
{'3'} {[5]} {[7]}
{[4]} {[9]} {[2]}
c =
3×3 cell array
{'8'} {[1]} {[6]}
{'3'} {[5]} {[7]}
{'4'} {[9]} {[2]}
c =
3×3 cell array
{'8'} {'1'} {[6]}
{'3'} {[5]} {[7]}
{'4'} {[9]} {[2]}
c =
3×3 cell array
{'8'} {'1'} {[6]}
{'3'} {'5'} {[7]}
{'4'} {[9]} {[2]}
c =
3×3 cell array
{'8'} {'1'} {[6]}
{'3'} {'5'} {[7]}
{'4'} {'9'} {[2]}
c =
3×3 cell array
{'8'} {'1'} {'6'}
{'3'} {'5'} {[7]}
{'4'} {'9'} {[2]}
c =
3×3 cell array
{'8'} {'1'} {'6'}
{'3'} {'5'} {'7'}
{'4'} {'9'} {[2]}
c =
3×3 cell array
{'8'} {'1'} {'6'}
{'3'} {'5'} {'7'}
{'4'} {'9'} {'2'}
|
Replace NaNs with the number that appears to its left in the row.
2018 Solvers
Create matrix of replicated elements
321 Solvers
516 Solvers
992 Solvers
405 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!