How to show the output of a function when you call the code in another file?
6 views (last 30 days)
Hello sir/mam, I am hereby to ask this question.
My question is that how to show the output of a self-made function from another file, without needing to write the "[x,y,z] = functionfromanotherfile(input)". To make it even clealer, I would like to say a file named "maincode.m" and a file named "functionA.m".
In the file "functionA.m", the first line of code is [x,y,z] = functionA(input);
and in the file "maincode.m", I wish to call the functionA(input); and directly generate the resulting outputs as x,y,z in the workspace. Butin the fille "maincode.m", if I didn't write it such as "[x,y,z] = functionA(input);" I will only get an answer in workspace of a single "answer" variable. So, how to make so that even though if I only write "functionA(input);" in maincode.m file, I can still generate those x,y,z variables in the workspace?
I hope the question is clear enough, and please let me know if it is not understandable. Thank you before!