Reputation: 27422
I have an m-file function and I want to use this file to to pass 2 function handles and 6 floating point numbers to the main file. I am trying to include all 8 into an array and output that from the m-file function, but this doesn't work. Is there a way to do this?
Upvotes: 2
Views: 574
Reputation: 74940
You can create arrays of function handles or of doubles, but in order to create an array that can contain both function handles and doubles, you need to use a cell array.
function output = myFunction(someInput)
%# create handle1, handle2, numbers 1-6
%# ...
%# assemble output:
%# output{1} contains the first handle
%# output{3} contains the first number
%# output{6} contains an array of numbers 4 through 6
output = {handle1, handle2, number1, number2, number3, [number4, number5, number6]};
Upvotes: 4