How to access data in a cell array

조회 수: 2 (최근 30일)
Francisco Anaya
Francisco Anaya 2019년 3월 27일
댓글: Francisco Anaya 2019년 3월 28일
I have a cell array (iwant variable) of 3x1...
...where each of the 3 arrays have 1x170 matrices.
Each one of the matrices have 7 column data of different lengths.
If I want to access the data of each column for all 170 matrices, how can I access it?
What I want is to create 7 different arrays (from c1 to c7) with the 1x170 matrices but containing only one column data at the time. As follows:
Here C1 contains only data from the first column of all 170 matrices. C2 should containg only data from the second colum of all 170 mitrices and so on.
FIG 4. c variable.PNG
Any help?

답변 (1개)

Walter Roberson
Walter Roberson 2019년 3월 28일
arrayfun(@(N) cellfun(@(M,N) M(:,N), staples, 'uniform', 0), 1:7, 'uniform', 0)
  댓글 수: 1
Francisco Anaya
Francisco Anaya 2019년 3월 28일
Hi. Thank you. I am using this instead...
C2= cellfun(@(x)x(:,1),C1,'UniformOutput',false);
And it worked

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by