How to loop over these values?

1 visualización (últimos 30 días)
Rizwana
Rizwana el 24 de Mzo. de 2014
Respondida: Andrei Bobrov el 24 de Mzo. de 2014
I have interpolated some data points in my fiigure window using data cursor functional and exported it. Its getting saved as structure...
Iam trying to loop them over so that i can get them all in some variable like out_var. I tried doing like this...
for i = 1 : length(cursor_info)
[out_var] = cursor_info(1,i).Position;
end
when i type out_var in command window, iam getting only last data set...
Please help me..
Thanks

Respuestas (2)

Chandrasekhar
Chandrasekhar el 24 de Mzo. de 2014
Try this..
for i = 1 : length(cursor_info)
out_var(i,1) = cursor_info(1,i).Position;
end
  2 comentarios
Rizwana
Rizwana el 24 de Mzo. de 2014
Its throwing error saying
Subscripted assignment dimension mismatch.
Chandrasekhar
Chandrasekhar el 24 de Mzo. de 2014
how the position variable look like..is it an array?
try this out.
for i = 1 : length(cursor_info)
out_var(i) = cursor_info(1,i).Position;
end

Iniciar sesión para comentar.


Andrei Bobrov
Andrei Bobrov el 24 de Mzo. de 2014
n = numel(cursor_info);
out_var = cell(n,1);
for ii = 1 : n
out_var{ii} = cursor_info(1,i).Position;
end

Categorías

Más información sobre MATLAB 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