How do I store a function file to a variable?

I use a function file to run some computations and it looks something like this
x_max(<input1,input2>=answer
after the function computes my command window displays
ans=<answer>
I would like to know how to store this answer a variable for which i could display using fprintf. For example, I would like to display something like
"the value of x_max is <answer>"

 採用された回答

James Tursa
James Tursa 2017 年 9 月 26 日

0 投票

Something like this assuming your function name is x_max
my_variable = x_max(input1,input2);
fprintf('The value of x_max is %g\n',my_variable);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeVariables についてさらに検索

質問済み:

2017 年 9 月 26 日

回答済み:

2017 年 9 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by