フィルターのクリア

How do I call to function from other function?

1 回表示 (過去 30 日間)
Jimmy cho
Jimmy cho 2020 年 8 月 9 日
回答済み: KSSV 2020 年 8 月 9 日
Hi guys, Im building two function with I call one of them from another function, so how can I call the other function in matlab? just write its name where I want to implement it?
I mean lets assume Im building two functions one called func1, the other function called func2 .. I want to call in the func1 to the func2 so what should I write inside the implemenation of func1 .. just func2 and then matlab compiler will call to the other implementation of func2? thanks alot.

採用された回答

KSSV
KSSV 2020 年 8 月 9 日
You need to save both the function files in the same folder and yes call the other function in the required function. It is very simple. Check the below example.
function val = thesum(a,b)
val = a+b ;
end
Now call the above function inisde another function.
function val = theproduct(a,b)
c = thesum(a,b) ;
val = c*a*b ;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by