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.

 채택된 답변

Oleg Komarov
Oleg Komarov 2011년 1월 28일

1 개 추천

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

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2011년 1월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by