- Use array2table instead of table (the wrong function, unless you really want the array in one variable).
- Get rid of all of that cell2mat and strcat and str2mat confusion (what are you concatenating? Nothing).
result_matrix = randi(5,7)
result_matrix =
5 1 1 1 1 2 2
2 2 4 1 4 5 1
5 5 2 4 5 3 3
2 1 5 4 4 2 4
3 3 2 5 1 4 5
3 5 4 3 1 3 3
4 3 4 5 5 2 2
●
C1 = arrayfun(@(x) sprintf('type%d', x), 1:nr, 'UniformOutput', false)
C1 =
{'type1'} {'type2'} {'type3'}
C2 = arrayfun(@(x) sprintf('binary%d', x), 1:nr, 'UniformOutput', false)
C2 =
{'binary1'} {'binary2'} {'binary3'}
T = array2table(result_matrix, 'VariableNames',VN)
T =
type1 type2 type3 binary1 binary2 binary3 result
_____ _____ _____ _______ _______ _______ ______
5 1 1 1 1 2 2
2 2 4 1 4 5 1
5 5 2 4 5 3 3
2 1 5 4 4 2 4
3 3 2 5 1 4 5
3 5 4 3 1 3 3
4 3 4 5 5 2 2
Best Answer