How to convert from a matrix to a cell?

조회 수: 1 (최근 30일)
SM
SM 2020년 7월 17일
댓글: Star Strider 2020년 7월 19일
Given matrix is
A=[1 2 3 4 5 6 7 8; 9 10 11 12 13 14 15 16];
and output is
B={[1 2 3 4],[5 6 7 8];[9 10 11 12],[13 14 15 16]};
How can I do that?

채택된 답변

Star Strider
Star Strider 2020년 7월 17일
Use the mat2cell function:
A=[1 2 3 4 5 6 7 8; 9 10 11 12 13 14 15 16];
B = mat2cell(A, [1 1], [4 4]);
B11 = B{1,1} % Check Output
B22 = B{2,2} % Check Output
  댓글 수: 2
SM
SM 2020년 7월 19일
Thank you so much!
Star Strider
Star Strider 2020년 7월 19일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Semiconductors and Converters에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by