필터 지우기
필터 지우기

Obtaining elements of a vector from a nested Cell Array

조회 수: 1 (최근 30일)
Deepak
Deepak 2013년 6월 4일
I have a cell array (see below)
ParameterCellArray{14,1}={'a,[50,100,180],'pe'}; %
ParameterCellArray{14,2}={'b',0.2:0.2:1,'co'};
ParameterCellArray{14,3}={'c',[1 1 1 1 0.2 0.4 0.6 0.7 0.8 0.9 1],'co'};
ParameterCellArray{14,4}={'d',[1 1 1 1 0.2 0.4 0.6], 'co'};
ParameterCellArray{14,5}={'e',130,'co'};
ParameterCellArray{14,6}={'f',[2 10 11 12],'pe'};
I would like to collect all the vectors i.e ParameterCellArray{14,1}{2} where ParameterCellArray{14,1}{3}='pe' in a new cell array which has only the numerical values. I can do this with a for loop but I am sure there is an easier way to do this. However ParameterCellArray{14,:}{2} gives me an error 'Bad Cell reference' Any help would be greatly appreciated.
Thanks a lot..

답변 (1개)

Iain
Iain 2013년 6월 4일
Try a three dimensional cell array
ParameterCellArray{row, column, deep}
deep = 1, to get the 'a','b', etc., deep = 2 to get the numbers, deep = 3 to get the 'pe'/'co'.

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by