Link to home
Start Free TrialLog in
Avatar of zzhang2006
zzhang2006Flag for United States of America

asked on

Matlab Function Returning multiple arrays and structures -- how to?

I have the following function which is syntactically fine, but I don't know how to access the "another' vector from the Command Window when the function is run.

function [out,another] = array_passing1(x)

out1 = [13, 17, 505]

out = [[x, 2*x, 3*x]; out1]  %a 2D array is returned


another = [7,8, 9]  % Is this returned? How to access it?
end

--------- Command Window --------------------------------------
 col = array_passing(2)
>> size(col)

ans =

     2     3            this is the dimension of the "out",  But how can I access the "another"


Thanks for the help!
Avatar of Yanai Ankri
Yanai Ankri

[col, another]  = array_passing(2)
Avatar of zzhang2006

ASKER

Exactly!   Thanks

Ze
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.