I have the following function in myFun.m file:
function f1 = myFun1(X,Y)
[f1,f2] = myFun2(X,Y);
For some reason, from my script file, I can call only
It is because the way I have a complicated script code. Nevertheless, I want output f2 to be available in my script right after function call f1 = myFun1(X,Y); in my script file myScript.m.
For illustration purpose, suppose:
X = [1 2; 4 5; 6 7];
Y = [8 9; 10 11];
f1 = myFun1(X,Y);
function [f1,f2] = myFun2(X,Y)
f1 = X*Y;
f2 = pdist2(X,Y);
In this illustration I made output f2 to be 3x2, but it could be any size, for example a 3x2x4 type double.
I will appreciate any advice!