Assigning output from separate .m file to variable
古いコメントを表示
I have a script (that I didn't write) IdealAir.m, found here: https://www.mathworks.com/matlabcentral/fileexchange/25030-ideal-air-properties. I need to assign the outputs of IdealAir to variables multiple times within a function that I wrote.
IdealAir interpolates from a table. It takes 3 arguments (a value, the variable to which the value is assigned, and the output variable), and assigns the output to a variable created within the script. Possible input and output variables are T, h, u ,pr, vr, and so. Example: IdealAir(2.5,'so','h') h = 664.0107
A simplified version of what I'm trying to do:
function dualrankine(T4)
H4=IdealAir(T4,'T','h');
P4=IdealAir(H4,'h','pr');
disp(H4);
disp(P4);
end
Obviously this is wrong, it spits back the following:
Error using IdealAir
Too many output arguments.
Error in dualrankine (line 2)
H4=IdealAir(T4,'T','h');
I tried nesting IdealAir within dualrankine, but it gave the following:
Error: File: dualrankine.m Line: 115 Column: 4
The function "IdealAir" was closed with an 'end', but at least one other function definition was not. To avoid
confusion when using nested functions, it is illegal to use both conventions in the same file.
Disclaimer: I'm not very experienced with Matlab. I've looked around for solutions, but either I haven't found one or I haven't recognized it. Please just direct me to the solution if it exists.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で File Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!