How to perform the following commands?

1 次查看(过去 30 天)
How to perform the following commands:
result1 = m(:,abs(m(2,:))< threshold ); .......... This line I want to exclude zero value also.(I mean if it zero ignore it and look at the next value)
[~,idx] = min(abs(result1(1,:))); ....... This line I want to exclude zero value also. (I mean if it zero ignore it and look at the next value)
  3 个评论
M
M 2022-5-24
编辑:M 2022-5-24
@Walter Roberson, what about the second line" [~,idx] = min(abs(result1(1,:))); "
I want to exclude zero value also from this, I mea take the next abs(min value) after zero?
Walter Roberson
Walter Roberson 2022-5-24
create a temporary vector that is abs() and replace 0 values with nan and min() that.
Or loop.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2022-5-24
temp = abs(result1(1,:));
temp(temp==0) = nan;
[~, idx] = min(temp) ;

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by