if with 2 conditions

16 次查看(过去 30 天)
james sinos
james sinos 2021-9-19
i used this statement conditions before it worked well,
but this time Matlab says it work with logic condition only:
how to recover ?
thanks

回答(1 个)

Image Analyst
Image Analyst 2021-9-19
What does this say
whos Ree
It's probably a vector, not a scalar.
  2 个评论
james sinos
james sinos 2021-9-19
yes you have write , i must make a loop i forgot that .
i hope for a scalar it does work.
thanks
Image Analyst
Image Analyst 2021-9-19
You might want to use any or all():
if any(Ree > 100000 & Ree < 1000000) % Check if any of them is in range.
if all(Ree > 100000 & Ree < 1000000) % Checks that ALL of them are in range.

请先登录,再进行评论。

类别

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

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by