how to convert a matrix to a cell array

Illustration
Ananyasingh - 2020-07-24T10:47:22+00:00
Question: how to convert a matrix to a cell array

I have a 2x10 matrix. Would anybody know how I could convert it into a 1x10 cell array - so that each cell contains a 2x1 matrix? I'm new to matlab and would appreciate any help.

Expert Answer

Profile picture of Prashant Kumar Prashant Kumar answered . 2025-11-20

please read about functions num2cell and mat2cell
eg:
 
out = num2cell(yourmatrix,1)

or

out = mat2cell(yourmatrix,2,ones(1,size(yourmatrix,2)))


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!