Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Passing data between fucntions

1 回表示 (過去 30 日間)
Adam Silva
Adam Silva 2014 年 10 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi
I have two functions: "1. inputdata.m" and "2. algorithm.m". All the input data to calculate values using algorithm.m are in inputdata.m file. I'm outputting a, bd, gas, and nopt as data from file 1.
Say I have A= ab, BD=bd, GAS=gas and NOPT=nopt in "algorithm.m". How can I load the data from algorithm.m.
Thanks

回答 (1 件)

Star Strider
Star Strider 2014 年 10 月 19 日
Function files:
[a, bd, gas, nopt] = function inputdata(args)
. . . code . . .
end
[outputs] = function algorithm(a, bd, gas, nopt)
. . . code . . .
end
then in your main script:
[a, bd, gas, nopt] = inputdata(args);
[outputs] = algorithm(a, bd, gas, nopt);
  2 件のコメント
Adam Silva
Adam Silva 2014 年 10 月 20 日
Thanks. It works.
Star Strider
Star Strider 2014 年 10 月 20 日
My pleasure!
The most sincere expression of appreciation here on MATLAB Answers is to Accept the answer that most closely solves your problem.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by