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.

 Accepted Answer

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 Comment

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

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!