[Scilab-users] Scilab function with variable input and output arguments

Rafael Guerra jrafaelbguerra at hotmail.com
Tue Sep 11 05:12:24 CEST 2012


Serge,

Thank you very much for your reply, your suggested solution worked like a
charm.

Best regards
Rafael

-----Original Message-----
From: users-bounces at lists.scilab.org [mailto:users-bounces at lists.scilab.org]
On Behalf Of Serge Steer
Sent: Monday, September 10, 2012 3:44 AM
To: users at lists.scilab.org
Subject: Re: [Scilab-users] Scilab function with variable input and output
arguments

May be you can simply define your function as

function output_matrix_list = myfunction(dz,input_matrix_list);

and call it as follow:

out = myfunction(dz,backuplist)

for i=1:N
   process the matrix out(i)
end

Serge Steer

Le 10/09/2012 04:44, Rafael Guerra a écrit :
> Hello all,
>
> I have a Scilab function defined with variable input and output arguments:
>      function [varargout] = myfunction(dz,varargin);
>      ...
> this function receives as input N matrices and outputs other N 
> matrices (N is variable).
>
> I managed to handle the variable inputs by defining a list (of matrices):
>     backuplist = list();
> and by putting in this backuplist the N matrices to be processed by
> myfynction:
> [matrix1 matrix2 .. matrixN] = myfunction(dz,backuplist(1:N));
>
> The coding problem lies with the left-hand side of the function call
above:
> one needs to specify all the output variables but their number is 
> variable during the execution of the program.
>
> It seems that in Scilab we cannot use the same trick as for the input, 
> i.e., to define a list of N matrices:
>      matrixlist = list();
> and call myfunction as:
>      matrixlist(1:N)= myfunction(dz,backuplist(1:N));
>
> How can this general Scilab programming problem be handled?
>
> Thanks in advance for your advice,
> Rafael
>
>
>
> --
> View this message in context: 
> http://mailinglists.scilab.org/Scilab-function-with-variable-input-and
> -output-arguments-tp4024796.html Sent from the Scilab users - Mailing 
> Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list