Is it possible to save an output of a function and pass it as an input to another function after some time steps?
Show older comments
So, I have three functions that I call every time step: for ii = 2:50 [G_dmg,Output2,output3] = Stages(G_dmg, Input2, Input3);
[G_dmg, output2] = decision(G_dmg);
% G_dmg is an object of three fields, Only the field "G_dmg.Nodes.Load"
% is changing and I want to store this field ( or the whole object) in each iteration.
if ~mod(ii,4) % if this condition is satisfied ( that is when ii=4,8,12,...) I want to pass the field "G_dmg.Nodes.Load"
% saved at (ii = 2,3,4,... and not the ones saved at ii = 4,8,12,...) to function implement
[G_dmg] = implement(G_dmg, Input2, Input3)
end
end
To simplify my comments:
The condition will be satisfied first at ii = 4, at this iteration I want to pass G_dmg that was saved at ii = 2. And at ii = 8 I want to pass the one that was saved at ii = 3 and so on.
I would appreciate your ideas.
Accepted Answer
More Answers (0)
Categories
Find more on Software Development in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!