Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - Português

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Ajuda Scilab >> API Scilab > Scilab Gateway API > LhsVar

LhsVar

a C gateway function which specifies which parameters created inside the C gateway will be returned as an output argument into Scilab.

Calling Sequence

LhsVar(RankPos) = RankVar;

Arguments

RankPos

as integer providing the rank of the output argument

RankVar

the rank of the parameter created inside the C gateway to be returned as an Scilab output argument

Description

A C gateway function which specifies which variables created inside the C interface will be returned as an output argumen into Scilab.

Examples

This example takes a matrix of doubles as input and returns:

  • the number of lines (first output argument)

  • the number of rows (second output argument)

We create an intermediate Scilab parameter which will handle an integer but will neither be used nor returned as an output argument.

TODO: insert an example in the Scilab language

#include "stack-c.h"
#include "api_scilab.h"
int sci_mysizedouble(char * fname, unsigned long fname_len)
{
    int         m_in_row;
    int         n_in_col;
    int         *piAddr = NULL;
    double      *pdblData = NULL;
    SciErr      sciErr;

    sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    /* get dimensions */
    sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &m_in_row, &n_in_col, &pdblData);
    if(sciErr.iErr)
    {
        printError(&sciErr, 0);
        return 0;
    }

    sciErr = createMatrixOfInteger32(pvApiCtx, 2, 1, 1, &m_in_row); // the out_lines_pos parameter handles the number of lines of the matrix sent as argument
    sciErr = createMatrixOfInteger32(pvApiCtx, 3, 1, 1, &m_in_row); // store a mere value, but will neither be used nor returned to Scilab
    sciErr = createMatrixOfInteger32(pvApiCtx, 4, 1, 1, &n_in_col); // store a mere value, but will neither be used nor returned to Scilab

    LhsVar(1) = 2; // We set the parameter 2 as an output argument
    LhsVar(2) = 4; // We set the parameter 4 as an output argument
    PutLhsVar();
    return 0;
}
<< Lhs Scilab Gateway API Rhs >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:11:55 CEST 2011