Plot a cell array with in each cell a different number of values

I have a cell array (10x5) and in each cell there are many values with a different length. (see picture)
Is there a possibility to plot each row in a different plot and within each plot the columns of the row?
Thanks!

2 Comments

What is your indepent variable for the plotting? Just the vector array index?
No, it is a cell array too.
On the x-axis I want my time, cell array of 10x5. (see picture) And on the y-axis I want my knee angle, which is a cell array too (10x5). (see picture)
The cells of the time and of the knee angle have the same length.
Thus I want a first plot with the first row and every colomn. So on the x-axis I want row 1 of time and on the y-axis I want row 1 of the knee angle. And then I want a second plot with row 2 of time on the x-axis and row 2 of the knee angle on the y-axis,...

Sign in to comment.

 Accepted Answer

You might as well just use a double nested loop over rows and columns.
Although you could do the inner loop as a cellfun(), with it needing two different array inputs and probably not wanting to plot anything for the nan entries, and with probably wanting to put up labels and legends... and with you needing 10 different plots (different figures? 5 x 2 subplots ?)... it all gets messy enough to vectorize that you might as well save the trouble and just loop writing clear code.

More Answers (0)

Asked:

on 14 Dec 2020

Commented:

on 14 Dec 2020

Community Treasure Hunt

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

Start Hunting!