Assigning output from separate .m file to variable
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!