How to trace back a subfunction
2 views (last 30 days)
Show older comments
Dear All,
Thanks for your time.
I am trying to find the best solution for an application, then trace back the subfunction which provide the calculation data and show which the subfunction is. e.g.
function [a]=b()
for i=1:2
c{1}=d()
c{2}=e()
a=20+c
end
f=min(a)
subfunction 1 which is
function [c]=d()
c=2
end
subfunction 2 which is
function [c]=e()
c=5
end
I would want to show which subfunction is used once achieving the minimum result f, is it function d or function b?
Thank you very much for your help in advance.
Zhe Li
0 Comments
Answers (1)
Thorsten
on 1 Feb 2013
Why don't you use something like
solution1 = 20 + d();
solution2 = 20 + e();
if solution1 < solution2
f = solution1;
disp('min result achieved with subfunction 1')
else
f = solution2;
disp('min result achieved with subfunction 2')
end
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!