[Scilab-users] Dump the output of a function

Clément David Clement.David at esi-group.com
Tue Jan 16 09:31:20 CET 2018


Hello Christian, Samuel,

My 2c, most of the modern languages supporting such a feature are using the one-character variable
trick; sometimes enforced by conventions. For example, Go, Rust and Python are using `_` as in :

[_,_,kb] = intersect(grand(1,10,"uin",0,9), grand(1,10,"uin",0,9));

This character appears as a visual blank thus the function call is easily readable.

Regards,

--
Clément

Le jeudi 11 janvier 2018 à 13:00 +0100, Samuel Gougeon a écrit :
> Hello Christian,
> 
> AFAIK there is presently no way to skip an output parameter. The more handy would be
> [,y2,,y4] = f(x)
> but unfortunately, it does not work (yet?).
> I did not find this feature as a wish on bugzilla. IMO it should be.
> It is possible to use a one-character variable name, for instance among %, #, ! or ?.
> 
> --> [%,%,kb] = intersect(grand(1,10,"uin",0,9), grand(1,10,"uin",0,9));
> --> kb
>  kb  = 
> 
>    7.   5.   2.
> 
> Even if the tilde was allowed, it is not very smart. A true blackhole would be better.
> 
> Regards
> Samuel
> 
> Le 11/01/2018 à 11:31, Soulard, Christian (GE Power) a écrit :
> > Hello,
> >  
> > What is the Scilab way to dump the output of a function ? The Matlab equivalent is tilde (~).
> >  
> > To give an example, suppose I have an existing function f such as :
> >  
> > function [y_1,y_2] = f(x)
> >                 y_1 = x ^ 2;
> >                 y_2 = x ^ 3;
> > enfunction
> >  
> > Suppose I want to use this function, but I am only interested in the y_2 result, and I don’t
> > want to assign a variable to the y_1 output. In Matlab, I would do the following way :
> >  
> > [~,b] = f(2)
> >  
> > I would only get a single output variable :
> >  
> > b = 8
> >  
> > Thank you for your feedback.
> >  
> > 
> > 
> > _______________________________________________
> > 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