Number of functions in a function-M file

1 Ansicht (letzte 30 Tage)
Shalini
Shalini am 5 Mär. 2012
Is it that there should be only one function in a function M file or there can be any number of functions in a function M file?

Akzeptierte Antwort

Igor de Britto
Igor de Britto am 5 Mär. 2012
A m-file can have more than one function.

Weitere Antworten (2)

Shalini
Shalini am 5 Mär. 2012
I have a function 'A'
Inside the function A, there is a variable computed 'z'
'z' should be returned from another function 'B' .'A' and 'B' should be in the same M file.
Can you tell me the syntax for such a situation/ returning a value within a function from another function?

Sean de Wolski
Sean de Wolski am 5 Mär. 2012
function z = A;
z = B;
function z = B;
z = pi;
All of it saved in B.m

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by