How do I take specific data from an array?

I have 50 different on column vectors, each defined at t0 through t49. I need to be able to use the data at a certain point from each vector, but the problem is the data I want is not going to be in the same row for all 50 vectors. I want to tell it to start reading when t(i+1)<ti for every file but I'm not sure how to run a loop to do this 50 different times.

2 comentarios

Kirby Fears
Kirby Fears el 18 de Sept. de 2015
Are these 50 column vectors already loaded into matlab memory? Are they 50 separate arrays, or is this a single table?
Kristen Brusich
Kristen Brusich el 18 de Sept. de 2015
they are 50 separate arrays already loaded into matlab

Iniciar sesión para comentar.

 Respuesta aceptada

Kirby Fears
Kirby Fears el 18 de Sept. de 2015
Editada: Kirby Fears el 18 de Sept. de 2015
For an Nx1 array V, you can contract V based on any conditional test such as the one you described. For example:
>> V=1:10;
>> V=V(V>5);
>> disp(V)
6 7 8 9 10
You should be able to use this kind of logic in a loop by applying your loop index.

2 comentarios

Kristen Brusich
Kristen Brusich el 18 de Sept. de 2015
Okay, I understand that but now how do I make that into a for loop to run each manifold?
Kristen,
I was going to ask for more information, but I see it's in your other question posted here.
I commented on your other question to help you get your vectors into a single cell. It's very easy to loop over a cell containing vectors to apply your logical statement to it.
C={1:10,1:20,1:7}; % sample cell of vectors
for iter=1:numel(C),
tempidx=C{iter}>5;
C{iter}=C{iter}(tempidx);
end,
Remember to accept my answer (and Walter's answer in your other post) if your questions have been answered.
Hope this helps.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Sept. de 2015

Comentada:

el 18 de Sept. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by