Obtaining elements of a vector from a nested Cell Array
Afficher commentaires plus anciens
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..
Réponses (1)
Iain
le 4 Juin 2013
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'.
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!