[Scilab-users] Dump the output of a function

Rafael Guerra jrafaelbguerra at hotmail.com
Thu Jan 11 16:52:56 CET 2018


(sorry, x=3 line was missing)

Hello,

In Scilab 6 you can do:

function y=f(x)
    y = list()
    y(1) = x ^ 2;
    y(2) = x ^ 3;
endfunction

-->x = 3;

--> y = f(x)(2)
y  =
   27.

--> y = f(x)(1)
y  =
   9.

Regards,
Rafael

From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Soulard, Christian (GE Power)
Sent: Thursday, January 11, 2018 11:31 AM
To: users at lists.scilab.org<mailto:users at lists.scilab.org>
Subject: [Scilab-users] Dump the output of a function

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180111/049b6400/attachment.htm>


More information about the users mailing list