How to trace back a subfunction
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Thorsten
2013년 2월 1일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!