get data from cell

8 visualizaciones (últimos 30 días)
Tian Lin
Tian Lin el 23 de Mzo. de 2011
I have a cell which structure is 1x5 like A=[1x25 double] [1x13 double] [1x9 double] [1x7 double] [1x5 double]. I know A{1:1} to get 1x1,A{1:2} to get 1x2. This cell is 1x5,but if a cell is 1xN,how can I get every array from A{1:1} to A{1:N}?

Respuestas (1)

Matt Tearle
Matt Tearle el 23 de Mzo. de 2011
A{:} will extract all the contents. However, the result will be in the form of a list. If the contents are all different sizes or types, there's not much you can do with the results. What are you trying to do with the arrays?
BTW, to get the (1,2) element of A, the syntax is A{1,2}, not A{1:2}. A{1:2} will extract elements 1 & 2 as a list.
  2 comentarios
Tian Lin
Tian Lin el 23 de Mzo. de 2011
I'm trying to find out all martix which is increasing in the cell A and put them into my calculate codes.
Matt Tearle
Matt Tearle el 23 de Mzo. de 2011
Sounds like the easiest approach might just be a loop:
for k = 1:length(A)
x = A{k};
% do stuff with x
end

Iniciar sesión para comentar.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by