Let's say your function will have a name myFunction. As I understood, you want to pass a parameter to this function and get two output variables from it.
To call the function you use the following syntax:
To build your own function crate a file->new, paste this code and save as a separate file:
function [ M n ] = myFunction(inputParameter)
n=5*inputParameter;
M=ones(10,10);
end
The function will return matrix 'M' 10x10 of ones and 'n' will be your input scaled by 5.
1 Comment
Jan (view profile)
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/24697-return-of-function#comment_54503
Sign in to comment.