Scilab 5.5.0
- Ajuda do Scilab
- API Scilab
- Low level functions
- AssignOutputVariable
- CallOverloadFunction
- CheckInputArgument
- CheckOutputArgument
- ReturnArguments
- Boolean reading (Scilab gateway)
- Boolean writing (Scilab gateway)
- Boolean sparse reading (Scilab gateway)
- Boolean sparse writing (Scilab gateway)
- Check variable dimensions (Scilab gateway)
- Variable Reference (Scilab gateway)
- Variable dimension (Scilab gateway)
- Variable Type (Scilab gateway)
- Variable Complexity (Scilab gateway)
- Matrix Type (Scilab gateway)
- deleteNamedVariable
- Double reading (Scilab gateway)
- Double writing (Scilab gateway)
- getNbInputArgument (Scilab gateway)
- getNbOutputArgument (Scilab gateway)
- Handle reading (Scilab gateway)
- Handle writing (Scilab gateway)
- Integer Precision (Scilab gateway)
- Integer reading (Scilab gateway)
- Integer writing (Scilab gateway)
- nbInputArgument (Scilab gateway)
- Pointer reading (Scilab gateway)
- Pointer writing (Scilab gateway)
- Polynomial Symbolic Variable (Scilab gateway)
- Polynomial reading (Scilab gateway)
- Polynomial writing (Scilab gateway)
- Sparse matrix reading (Scilab gateway)
- Sparse writing (Scilab gateway)
- String reading (Scilab gateway)
- String writing (Scilab gateway)
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.
Check variable dimensions (Scilab gateway)
A C gateway functions which check dimensions of a variable.
Calling Sequence
int checkVarDimension(void* _pvCtx, int* _piAddress, int _iRows, int _iCols)
int isRowVector(void* _pvCtx, int* _piAddress)
int isColumnVector(void* _pvCtx, int* _piAddress)
int isVector(void* _pvCtx, int* _piAddress)
int isScalar(void* _pvCtx, int* _piAddress)
int isSquareMatrix(void* _pvCtx, int* _piAddress)
int isEmptyMatrix(void* _pvCtx, int* _piAddress)
Arguments
- _pvCtx
Scilab environment pointer, pass in "pvApiCtx" provided by api_scilab.h
- _piAddress
Address of the Scilab variable.
- _iRows
Expected row count
- _iCols
Expected col count
Description
A C gateway functions which check dimensions of a variable.
Examples
In this example, the C interface function can take several input arguments and prints input dimensions and several test results.
#include "api_scilab.h" #include "sciprint.h" int check_matrix_dimension(char * fname) { SciErr sciErr; int* piAddr = NULL; int iRows = 0; int iCols = 0; CheckInputArgument(pvApiCtx, 1, 1); sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); if(sciErr.iErr) { printError(&sciErr, 0); return 1; } sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols); if(sciErr.iErr) { printError(&sciErr, 0); return 1; } if(checkVarDimension(pvApiCtx, piAddr, iCols, iRows)) { sciprint("checkVarDimension returns false\n"); } else { sciprint("checkVarDimension returns true\n"); } if(isRowVector(pvApiCtx, piAddr)) { sciprint("isRowVector\n"); } if(isColumnVector(pvApiCtx, piAddr)) { sciprint("isColumnVector\n"); } if(isVector(pvApiCtx, piAddr)) { sciprint("isVector\n"); } if(isScalar(pvApiCtx, piAddr)) { sciprint("isScalar\n"); } if(isSquareMatrix(pvApiCtx, piAddr)) { sciprint("isSquareMatrix\n"); } if(isEmptyMatrix(pvApiCtx, piAddr)) { sciprint("isEmptyMatrix\n"); } //no return value AssignOutputVariable(pvApiCtx, 0) = 1; return 0; }
Scilab test script
check_matrix_dimension([1,2,3;4,5,6]); check_matrix_dimension([1,2,3]); check_matrix_dimension([1;2;3]); check_matrix_dimension([1]); check_matrix_dimension([1,2;3,4]); check_matrix_dimension([]);
See Also
- sciprint — A C gateway function which displays standard messages to the user (same profil as the C printf function)
Report an issue | ||
<< Boolean sparse writing (Scilab gateway) | Low level functions | Variable Reference (Scilab gateway) >> |