how to use "if" statement properly?
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
i am performing an element -wise operation on 2 columns, A & B.
1. z=B./A
if z is less than 1 then reverse operation for that element and multiply by -1
2. if z<1 3. (A./B)*-1 end but it does not work. this should be simple. can someone help please thanks jb
1 件のコメント
Walter Roberson
2013 年 6 月 4 日
回答 (1 件)
Iman Ansari
2013 年 6 月 4 日
A=rand(10,1);
B=rand(10,1);
z=B./A;
z(z<1)=-1./z(z<1)
1 件のコメント
john borsellino
2013 年 6 月 4 日
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!