How do write a function within the same main code
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everybody,
I want to know if it is possible to write a function within the same main code rather than write it in separate M file.
Thanks in advance for any help.
0 Kommentare
Akzeptierte Antwort
Matt Fig
am 8 Apr. 2011
Put all of this into one M-file. Then call it like this: get_sub(5)
function [OUT] = get_sub(A)
OUT = subfun(A); % Call the subfunction.
function [OUT_SUB] = subfun(B)
OUT_SUB = B.^2;
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Holidays / Seasons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!