Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - Français

Change language to:
English - 日本語 - Português

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.

Manuel 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.

WARNING: This API is deprecated from Scilab 5.2.0 and is going to be removed with Scilab 6.0. Please use API Scilab (the new Scilab API).

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>

int sci_mysizedouble(char * fname)
{
  int m_in_row,          n_in_col,          l_in_pos;
  int m_out_lines_row,   n_out_lines_col,   l_out_lines_pos;
  int m_out_columns_row, n_out_columns_col, l_out_columns_pos;
  int m_nop,             n_nop,             l_nop;
  
  GetRhsVar(1, MATRIX_OF_DOUBLE_DATATYPE, &m_in_row, &n_in_col, &l_in_pos);

  m_out_lines_row   = 1; n_out_lines_col   = 1; // We create a scalar
  m_out_columns_row = 1; n_out_columns_col = 1; // We create a scalar
  m_nop             = 1; n_nop             = 1; // We create a scalar

  CreateVar(2, MATRIX_OF_INTEGER_DATATYPE, &m_out_lines_row,   &n_out_lines_col,   &l_out_lines_pos);
  CreateVar(3, MATRIX_OF_INTEGER_DATATYPE, &m_nop,             &n_nop,             &l_nop);
  CreateVar(4, MATRIX_OF_INTEGER_DATATYPE, &m_out_columns_row, &n_out_columns_col, &l_out_columns_pos);

  *istk(l_out_lines_pos)   = m_in_row; // the out_lines_pos parameter handles the number of lines of the matrix sent as argument
  *istk(l_nop)             = 1; // store a mere value, but will neither be used nor returned to Scilab
  *istk(l_out_columns_pos) = n_in_col; // the out_columns_pos parameter handles the number of columns of the matrix sent as argument

  LhsVar(1) = 2; // We set the parameter 2 as an output argument
  LhsVar(2) = 4; // We set the parameter 4 as an output argument

  return 0;
}
<< Lhs Scilab Gateway API NumOpt >>

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 Jan 26 16:24:17 CET 2011