how to convert a matrix to a cell array

A
Ananyasingh · Jul 24, 2020 · 2K views
Question
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 PhD Expert
Answered Aug 17, 2026
please read about functions num2cell and mat2cell
eg:
 
out = num2cell(yourmatrix,1)

or

out = mat2cell(yourmatrix,2,ones(1,size(yourmatrix,2)))
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!