How do I write a statement that will discard any values in an array if they are over a certain value?

I want to say that if my height variable is > 1 then not to return the value in my matrix?

댓글 수: 3

Could you be more precise.. some code perhaps will help.. please go over this tutorial on how to ask a question (on Answers) and get a fast answer - http://www.mathworks.com/matlabcentral/answers/6200/
I have a 73 x 1 array and in the column I only want to read in the row if the value is less than 1.. I have imported the file in by writing:
File = xlsread('Group B input.xlsx');
And I now want to say that matlab should only read in the values < 1
It is easier to import everything to Matlab and then do the processing. Alternatively you could preprocess in Excel if you are more comfortable doing that.

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

답변 (1개)

I think you're looking for logical indexing:
heights = .1:.3:2
heights < 1
heights(heights<1)

카테고리

도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2013년 5월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by