Info
この質問は閉じられています。 編集または回答するには再度開いてください。
problem in vectorize script
2 ビュー (過去 30 日間)
古いコメントを表示
Hi
I want to improve my script as:
a=round(50*rand(5,7)+50);
for ii=1
for jj=1
if a(ii,jj)>= 60
b1=2*a(ii,jj)
else
b2=-1*a(ii,jj)
end
end
end
b=b1+b2;
to vetcorized. How can I do that?
Thanks a lot
Mani
1 件のコメント
回答 (2 件)
Rick Rosson
2014 年 10 月 19 日
a = round(50*rand(5,7)+50);
b = 2*a;
b(a<60) = -a;
1 件のコメント
Jan
2014 年 10 月 19 日
The right hand sige need to be masked also:
b(a<60) = -a(a<60);
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!