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 IdealAirToo 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: 4The function "IdealAir" was closed with an 'end', but at least one other function definition was not. To avoidconfusion 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.
Best Answer