Effacer les filtres
Effacer les filtres

How to trace back a subfunction

1 vue (au cours des 30 derniers jours)
zhe li
zhe li le 1 Fév 2013
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

Réponses (1)

Thorsten
Thorsten le 1 Fév 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

Catégories

En savoir plus sur Debugging and Analysis dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by