Info
此问题已关闭。 请重新打开它进行编辑或回答。
Passing data between fucntions
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 个评论
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!