Convert cells arrays into a matrix

9 views (last 30 days)
yann Bassolo
yann Bassolo on 25 Aug 2018
Edited: jonas on 25 Aug 2018
I have Norm matrix (well I believe). This matrix is made of made different matrices coming from samples ECG samples. Each of the array inside has only one vector of different size when I try to convert into a csv file, i have the following message :' The input cell array cannot be converted to a matrix.' here is the
% code
csvwrite('Norm.csv', Norm)
however, when I try try it to one array or vector of the matrix it odes work.
if true
csvwrite('Norm.csv', Norm{1})
end
How can i get the whole matrix on a csv format

Answers (1)

jonas
jonas on 25 Aug 2018
Edited: jonas on 25 Aug 2018
csvwrite does not accept cell arrays and you cannot simply use cell2mat because your vectors have different number of rows. One way would be to pad the shorter vectors with NaNs. Here's a FEX function that does exactly that:
Downside is that you end up with a bunch of NaNs in your output csv.

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!