フィルターのクリア

1.2 is greater than 2.000000 in Matlab?

3 ビュー (過去 30 日間)
Rahim Rahim
Rahim Rahim 2020 年 12 月 20 日
編集済み: John D'Errico 2020 年 12 月 20 日
I want compare between two numbers:
Archive=[0.49984 , 0.26012]
x= Archive(1)- Archive(2);
if(x <=1)
"yes"
end
Always "yes" is shown, who can solve that problem ?
  3 件のコメント
dpb
dpb 2020 年 12 月 20 日
Where do the numbers 1.2 and 2 in the Q? title come from? Neither is in the code example nor does any operation on the values of Archive make either value.
Coding note:
x= Archive(1)- Archive(2);
is written more succinctly in MATLAB syntax as
x=-diff(Archive);
John D'Errico
John D'Errico 2020 年 12 月 20 日
編集済み: John D'Errico 2020 年 12 月 20 日
Yes. 1.2 is greater than 2 in MATLAB, but only on alternate Tuesdays, in months that end in y. And since this is now December...
Seriously, if you are going to show an example of something that is a problem, you might look at the numbers in that example, to see if they actually do what you think.
My guess is you had some sort of bug in your code, and the numbers in the arrays were not what you thought they were. And then you jumped to report what you thought was a problem without ever investigating what you had, or even looking at what you just pasted in as your question.
When you see a problem, stop. Look carefully at the data.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by