필터 지우기
필터 지우기

how to convert a matrix to a cell array

조회 수: 110 (최근 30일)
John
John 2012년 7월 30일
댓글: william katzianer 2020년 7월 21일
Hi there,
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.
Kind Regards
John

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 7월 30일
편집: Andrei Bobrov 2012년 7월 30일
please read about functions num2cell and mat2cell
eg:
out = num2cell(yourmatrix,1)
or
out = mat2cell(yourmatrix,2,ones(1,size(yourmatrix,2)))
  댓글 수: 1
Raphael
Raphael 2013년 5월 17일
Dear,
Do you know how to save the cell array created by the function?
Best regards,
Raphael

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

venkat vasu
venkat vasu 2012년 7월 30일
편집: Walter Roberson 2012년 7월 30일
X= reshape(1:20,2,10)'
C = mat2cell(X, [1,10],[2,1]);
celldisp(C);

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by