str2num

How to convert numbers in cell array to a numerical matrix?

a) convert numerical cell array to matrix

C={ [1],[2],[3]; [4],[5],[6] }

[1] [2] [3]

[4] [5] [6]

cell2mat(C)

1 2 3

4 5 6

b) convert text string cell array to matrix

C={ '1','2','3' ; '4','5','6' }

'1' '2' '3'

'4' '5' '6'

cellfun(@str2double,C)

1 2 3

4 5 6

read more:

cellfun()

https://mathworks.com/help/matlab/ref/cell2mat.html

https://mathworks.com/help/matlab/ref/cellfun.html