Loop is not looping
显示 更早的评论
Hi guys, this is my final questions. So the objective of this program is to find all combinations of a, b, and c that equal zero. I want it to keep spitting out combinations until it's found all possible ones, but right now if I run it, it will either not get one and stop, or it will get a few and then stop. Here is the code:
F = [-5,-4,-3,-2,-1,1,2,3,4,5];
T = @(a,b,c) (a + b + c);
for m=F
a = randsample (F,1);
b = randsample (F,1);
c = randsample (F,1);
if T(a,b,c) == 0
disp ([a b c]);
end
end
Thanks for the help in advance.
2 个评论
per isakson
2012-4-29
Loop loops ten loops, but with ten there is a probability that no combination of a, b and c fulfills the condition.
Nathaniel Ewing
2012-4-29
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Stable Distribution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!