File column selection in a matrix using a criterion

I´m a beginner in MATLAB. I´m trying to automate some data processing and I have a problem. I want to select information from a matrix acording to a criterion. Imagine I have a matrix (3,10) with different values in all the cells. What I want to do is ask the program to create a new matrix but with a criterion. In my case my criterion is telling the program to select only those files where the values of column 3 are smaller than 100, for example.

 Respuesta aceptada

Oleg Komarov
Oleg Komarov el 28 de En. de 2011
I assume that your criteria is that all (any is a different criterion) of the values in column 3 are smaller than 100:
% Create ex matrix
A = randn(3,10);
% Verify criterion (1 true, 0 false)
idx = all(A(:,3) < 100);
Then the point here is that you have to store your matrixes in a certain way to be able to select them programmatically, one possible way would be to use cell arrays (note that in general referring to cells when using double matrixes is wrong)
Oleg

1 comentario

GORKA
GORKA el 28 de En. de 2011
Sorry, my English is not very good. My criteria is to select only those that are smaller than 100, in this case.
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 28 de En. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by