Combinations running through for loop
12 次查看(过去 30 天)
显示 更早的评论
I have written the code for generating combinations for the given set of data and then each combination goes through code using for loop. However, after running code for each combination I can see the output for only the last combination in the workspace.
3 个评论
采纳的回答
KALYAN ACHARJYA
2021-2-17
编辑:KALYAN ACHARJYA
2021-2-17
Because it is a function file, the output arguments only reflects in the workspace
function [.....]=fun_name(.....)
%.........^ Output Arguments
end
Or
Define all varibles in the output arguments lists, which you wish to reflects in the workspace
function [Result,B]=fun_name(.....)
%.........^ Output Arguments
end
Or Try with without function file
Altitude=...?
Mach=.....?
for Alti = 1:length (Altitude)
A= Altitude(Alti);
for Velo= 1:length(Mach)
B=Mach(Velo);
disp(A);
disp(B);
Result = A+B;
disp(Result);
end
3 个评论
KALYAN ACHARJYA
2021-2-17
Store in an array
Result=zeros(1,length(Mach))
for Velo= 1:length(Mach)
B=Mach(Velo);
Result(Velo)= A+B;
disp(Result);
.....
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

