- Aide Scilab
- API Scilab
- Scilab Gateway API
- How to
- CheckColumn
- CheckDimProp
- CheckDims
- CheckLength
- CheckLhs
- CheckRhs
- CheckRow
- CheckSameDims
- CheckScalar
- CheckSquare
- CheckVector
- CreateListVarFrom
- CreateListVarFromPtr
- CreateVar
- FindOpt
- FirstOpt
- GetListRhsVar
- GetRhsVar
- GetType
- IsOpt
- Lhs
- LhsVar
- NumOpt
- OverLoad
- Rhs
- Scierror
- Scilab C Types
- get_optionals
- istk
- sci_types
- sciprint
- stk
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.
CreateListVarFromPtr
a C interface function which allows to create a new Scilab parameter from a pointer in a [mt]list
Calling Sequence
CreateListVarFrom(StackPos, Type, &m_rows, &n_cols, &l_stack_list_pos, void * Pointer);
Arguments
- StackPos
the rank of the parameter to be created (input parameter)
- Type
the Scilab type of the parameter to be created (input parameter). Can be (see Scilab C Type for more informations):
STRING_DATATYPE "c"
MATRIX_OF_STRING_DATATYPE "S"
MATRIX_OF_DOUBLE_DATATYPE "d"
MATRIX_OF_RATIONAL_DATATYPE "r"
MATRIX_OF_VARIABLE_SIZE_INTEGER_DATATYPE "I"
MATRIX_OF_INTEGER_DATATYPE "i"
MATRIX_OF_BOOLEAN_DATATYPE "b"
MATRIX_OF_COMPLEX_DATATYPE "z"
SPARSE_MATRIX_DATATYPE "s"
TYPED_LIST_DATATYPE "t"
MATRIX_ORIENTED_TYPED_LIST_DATATYPE "m"
SCILAB_POINTER_DATATYPE "p"
GRAPHICAL_HANDLE_DATATYPE "h"
EXTERNAL_DATATYPE "f"
MATRIX_OF_POLYNOMIAL_DATATYPE "x"
- m_rows
the number of lines of the matrix to be created (input parameter)
- n_cols
the number of columns of the matrix to be created (input parameter)
- l_stack_list_pos
the position in the Scilab memory of the created parameter in the list (output parameter)
- Pointer
the pointer to the data area (input parameter)
Description
A C interface function which allows to create a new Scilab parameter from a pointer in a [mt]list
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
#include <stack-c.h> #include <string.h> int sci_create_list(char * fname) { int m_list_out, n_list_out; int m_var1, n_var1, l_var1, l_list_var1; int m_var2, n_var2, l_var2, l_list_var2; int m_mlist, n_mlist, l_mlist; // The labels of our mlist static const char * ListLabels [] = {"mylist","var1","var2"}; // First, we create the variables using a classical way // The size of the Scilab variables m_var1 = 1; n_var1 = strlen("a string")+1; // a null terminated string m_var2 = 2; n_var2 = 2; // A 2x2 double matrix m_mlist = 3; n_mlist = 1; // A mlist with 3 elements // Creation of the Scilab variables // A('var1') CreateVar(1, "c", &m_var1, &n_var1, &l_var1); // A('var2') CreateVar(2, "d", &m_var2, &n_var2, &l_var2); // A CreateVar(3, "m", &m_mlist, &n_mlist, &l_mlist); // We store values in the create variables // The matrix will be stored in A('var2') *stk(l_var2+0) = 1; *stk(l_var2+1) = 2; *stk(l_var2+2) = 3; *stk(l_var2+3) = 4; // The string will be stored in A('var1') strncpy(cstk(l_var1),"a string\0",n_var1); m_list_out = 3; n_list_out = 1; // now, affect the variable to the mlist // The labels (it corresponds to A = mlist(['mylist','var1','var2'], ... CreateListVarFromPtr(3, 1, "S", &m_list_out, &n_list_out, ListLabels); // The value stored in A('var1') (it corresponds to A = ...,'a string', ... CreateListVarFrom(3, 2, "c", &m_var1, &n_var1, &l_list_var1, &l_var1); // The value stored in A('var2') (it corresponds to A = ...,[1 2,3 4]); CreateListVarFrom(3, 3, "d", &m_var2, &n_var2, &l_list_var2, &l_var2); // We return only the mlist which has been created at position 3 LhsVar(1) = 3; return 0; }
This example is available in SCI/modules/core/example/create_list.
See Also
- Scilab C Type — the C types available in a C gateway
- istk — Return a pointer to an integer to access data stored at a given position in the Scilab memory
- LhsVar — a C gateway function which specifies which parameters created inside the C gateway will be returned as an output argument into Scilab.
- CreateVar — a C gateway function which allows to create a new Scilab parameter
<< CreateListVarFrom | Scilab Gateway API | CreateVar >> |