MATLAB Answers

How to make a column of cells into array? Each cell in a row when made into an array would a row with different number of columns

1 view (last 30 days)
In-chan Kim
In-chan Kim on 6 Feb 2020
Commented: In-chan Kim on 7 Feb 2020
Can I also ask, how can I make into arrays a column of cell files?
timeatstayandtripcomp=Scenario1_indvoutputagg(1:r,88); %each row of the cell represents the variable for each ID
timeatstayandtripcomp=cell2mat(timeatstayandtripcomp);
I'd like each row in there to be an array. I've tried cell2mat but get Error using cat; I think it's because the number of columns for each row isn't necessarily the same.
I could maybe do a for loop, but I need to repeat this for many variables, so I'm wondering if there's a more efficient way of doing it
Capture.JPG

Accepted Answer

Stephen
Stephen on 6 Feb 2020
Edited: Stephen on 6 Feb 2020
Download Jos's padcat:
and use it like this:
M = padcat(Scenario1_indvoutputagg{1:r,88})
  3 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by