[問題] 條件設定已回收
clear all
A = 1; B = 2; C = 3;
j=0;
for i=1:1*1000;
xyz = round(1+10*abs(randn(1,3)))
x = xyz(1,1); y = xyz(1,2); z = xyz(1,3);
if A*x+B*y+C*z >= 10 & A*x+B*y+C*z <= 15
j=j+1;
Q(j,1)=x;
Q(j,2)=y;
Q(j,3)=z;
else xyz = round(1+10*abs(randn(1,3)));
x = xyz(1,1); y = xyz(1,2); z = xyz(1,3);
end
disp(i)
end
怎樣設定條件j=10的時候停止迴圈???(10組abc符合條件)
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.121.150.175
→
10/14 16:05, , 1F
10/14 16:05, 1F
→
10/14 17:20, , 2F
10/14 17:20, 2F
推
10/14 21:40, , 3F
10/14 21:40, 3F
MATLAB 近期熱門文章
PTT數位生活區 即時熱門文章