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

Serge Steer Serge.Steer at inria.fr
Mon Sep 10 08:43:42 CEST 2012


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
>




More information about the users mailing list