How to select element of an array between two values?

46 次查看(过去 30 天)
Hi,
I have an array of 2800 elements < 2800 x 1 double >, and I want to create a new array only with the values that are greater than -0.15 and less than 0.15. Many Thanks in advance.
Regards, Martha

采纳的回答

Walter Roberson
Walter Roberson 2014-3-24
A(A > -0.15 & A < 0.15)
or
A(abs(A) < 0.15)
  4 个评论
Martha
Martha 2014-3-24
My apologies Walter, I tried again and it works perfectly. Thank you very much!

请先登录,再进行评论。

更多回答(1 个)

Martha
Martha 2014-3-24
Thanks Walter,
Both work very well! Do you know also how to do the same but with several columns?, That is, having < 2800 x 3 > but analyzing only values from the first column and return the values from the given rows but all the columns.
Thanks
Martha

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by