i want to make a for loop that goes like this for a=0:1:180 && 179:-1:-180 but it is not possible in matlab, any ideas how to do it?

1 回表示 (過去 30 日間)
i want to make a for loop that goes like this for a=0:1:180 && 179:-1:-180 but it is not possible in matlab, any ideas how to do it?
i cant use the && or the in matlab and i cant find any other way to do it!
  3 件のコメント
abbxucy11
abbxucy11 2016 年 12 月 2 日
i mean it is not possible to use && or for the and expression
Stephen23
Stephen23 2016 年 12 月 3 日
編集済み: Stephen23 2016 年 12 月 3 日
"i mean it is not possible to use && or for the and expression"
The short circuit AND operator && works perfectly, exactly as per the documentation. Did you read it?
>> 1 && (1 || 0)
ans = 1

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

採用された回答

James Tursa
James Tursa 2016 年 11 月 30 日
編集済み: James Tursa 2016 年 11 月 30 日
It is not clear to me what you really want. Maybe this?
for a=[0:1:180,179:-1:-180]
% whatever
end

その他の回答 (1 件)

Star Strider
Star Strider 2016 年 11 月 30 日
You need to concatenate the vectors, not logically ‘and’. See if this does what you want:
q = [];
for a=[0:1:180 179:-1:-180]
q = [q a];
end
plot(q)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by