Cody

Problem 380. Convert a numerical matrix into a cell array of strings

Solution 1236932

Submitted on 22 Jul 2017 by Augusto Mazzei
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

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

ans = 1×3 cell array [49] [50] [51]

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 ans = 1×2 cell array [48] [53]

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' ans = 3×3 cell array [56] [49] [54] [51] [53] [55] [52] [57] [50]