How can I use one variable between two function ?

5 ビュー (過去 30 日間)
Dipten
Dipten 2014 年 2 月 28 日
編集済み: Mischa Kim 2014 年 2 月 28 日
I want to use single variable between two function that created by me. so how can i do this ??

採用された回答

Mischa Kim
Mischa Kim 2014 年 2 月 28 日
編集済み: Mischa Kim 2014 年 2 月 28 日
Dipten, you can simply pass those variables as input and output parameters between your functions. E.g.
function val1 = my_fun1(inp1)
...
inp = ...
v2 = my_fun2(inp); % call my_fun2 with parameter inp
end
function val2 = my_fun2(inp2) % in this case inp2 = inp
... % do some computations
val2 = ... % and return val2 to the calling function
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Identification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by