MATLAB Answers


Store every n rows of a matrix in cell

Asked by pavlos
on 16 Sep 2018
Latest activity Commented on by Rik
on 19 Sep 2018
Please help me with the following:
Consider a 11808x1 matrix A.
I need to take every 96 elements and store them in cell B.
The first element of B would have 1-96 elements of A, the second would have 97-192, etc.
Thank you.
Best, Pavlos


Sign in to comment.

1 Answer

Answer by Rik
on 16 Sep 2018
 Accepted Answer

You can do that with the mat2cell function.
Note that this doesn't work for splits that are not equal size (so a group size of 5 doesn't work).

  1 Comment

on 19 Sep 2018
Did this suggestion solve your problem? If so, please consider marking it as accepted answer. It will make it easier for other people with the same question to find an answer. If this didn't solve your question, please comment with what problems you are still having.

Sign in to comment.