Problems with and/or commands...

Hey everyone,
I am using an if-condition within a loop. The loop is t=1:100.
The if-condition is
t>=sz1 && t<=sz2
ZZ(t)=2;
elseif t>=sz3 && t<=sz4
ZZ(t)=2;
elseif t>=sz5 && t<=sz6
ZZ(t)=2;
else
ZZ(t)=1;
end
sz1...sz6 represent number that I have defined earlier.
Now matlab gives me the following errors message: Operands to the and && operators must be convertible to logical scalar values.
What did I do wrong??
Thanks a lot!!

 採用された回答

Star Strider
Star Strider 2014 年 11 月 17 日

0 投票

You only need single & operators for what you’re doing.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

質問済み:

2014 年 11 月 17 日

回答済み:

2014 年 11 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by