[Scilab-users] varargout doubt
shamikam
shamika.i.nair at gmail.com
Tue Nov 8 15:28:04 CET 2016
Thanks for your reply but that didn't work. I would like to illustrate with a
simple example-
function varargout_list=exampl()
[lhs,rhs]=argn(0);
varargout_list = list(1:lhs);
for i=1:lhs
varargout_list(i)=list(ex())
end
endfunction
function [x,y,z]=ex()
x=[1 2 3;4 5 6];
y=[4 5 6;7 8 9];
z=10;
endfunction
exampl() calls ex(). If I call exampl() with more than one o/p argument,
there is an error
-->[c,d,e]=exampl()
!--error 59
Wrong number of output arguments.
-->[c,d]=exampl()
!--error 59
Wrong number of output arguments.
-->c=exampl()
c =
c(1)
1. 2. 3.
4. 5. 6.
If I change varargout_list to varargout like this
function varargout=exampl()
varargout=list(ex())
endfunction
and call exampl(), I get the following errors-
-->[c,d,e]=exampl()
!--error 21
Invalid index.
-->[c,d]=exampl()
!--error 21
Invalid index.
-->c=exampl()
c =
1. 2. 3.
4. 5. 6.
How can I get varargout to work for any number of o/p arguments?
--
View this message in context: http://mailinglists.scilab.org/Scilab-users-varargout-doubt-tp4034928p4034935.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list