Scilab 5.3.1
- Aide Scilab
- API call_scilab (moteur Scilab)
- Boolean management
- Complex management
- DisableInteractiveMode
- Double management
- GetLastJob
- ScilabHaveAGraph
- SendScilabJob
- SendScilabJobs
- StartScilab
- String management
- TerminateScilab
- call_scilab
- Compile and run with Call Scilab
- creadbmat (obsolete)
- creadchain (obsolete)
- creadcmat (obsolete)
- creadmat (obsolete)
- cwritebmat (obsolete)
- cwritechain (obsolete)
- cwritecmat (obsolete)
- cwritemat (obsolete)
- fromc
- fromjava
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.
Boolean management
How to manage Scilab's boolean read and write process using call_scilab and api_scilab
Description
This help describes how boolean and matrix of booleans can be handle through the Call Scilab API and api Scilab.
There are several functions which can be used to read / write from the memory of Scilab. These functions are described in dedicated pages.
Note: Access to variables is done through api Scilab (named variable).
Examples
/* * Write a matrix of boolean into Scilab * B=[F F T F; * F F F T ] * Note that it is done column by column */ int B[]={0,0,0,0,1,0,0,1}; /* Declare the matrix */ int rowB=2, colB=4; /* Size of the matrix */ char variableNameB[] = "B"; SciErr sciErr; /* Write it into Scilab's memory */ sciErr = createNamedMatrixOfBoolean(pvApiCtx, variableNameB, rowB, colB, B); if(sciErr.iErr) { printError(&sciErr, 0); } /* * Prior to Scilab 5.2: * C2F(cwritebmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); */ printf("Display from Scilab of B:\n"); SendScilabJob("disp(B);"); /* Display B */
/* Read the previously declared matrix of boolean B */ int rowB_ = 0, colB_ = 0, lp_ = 0; int i = 0, j = 0; int *matrixOfBooleanB = NULL; /* Int instead of double */ char variableToBeRetrievedB[] = "B"; SciErr sciErr; /* First, retrieve the size of the matrix */ sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL); if(sciErr.iErr) { printError(&sciErr, 0); } /* * Prior to Scilab 5.2: * C2F(cmatbptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); */ /* Alloc the memory */ matrixOfBooleanB=(int*)malloc((rowB_*colB_)*sizeof(int)); /* Load the matrix */ sciErr = readNamedMatrixOfBoolean(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfBooleanB); if(sciErr.iErr) { printError(&sciErr, 0); } /* * Prior to Scilab 5.2: * C2F(creadbmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfBooleanB,strlen(variableToBeRetrievedB) ); */ printf("\n"); printf("Display from B formated (size: %d, %d):\n",rowB_, colB_); for(j = 0 ; j < rowB_ ; j++) { for(i = 0 ; i < colB_ ; i++) { /* Display the formated matrix ... the way the user expects */ printf("%d ",matrixOfBooleanB[i * rowB_ + j]); } printf("\n"); /* New row of the matrix */ }
See Also
- api Scilab — api_scilab is the Scilab interface to read/write data from/to Scilab memory
- call_scilab — call_scilab is an interface which provides the ability to call Scilab engine from C/C++ code
- API_Scilab: Boolean reading — How to read matrix of boolean.
- API_Scilab: Boolean writing — How to write matrices of boolean.
- SendScilabJob — Send a Scilab task from a C/C++ code (call_scilab)
- StartScilab — Initializes and starts Scilab engine in Call Scilab
- Call_Scilab: Double Management — How to manage Scilab's variable read and write process using call_scilab and api_scilab
- Call_Scilab: Complex Management — How to manage Scilab's complex variable read and write process using call_scilab
- Call_Scilab: String Management — How to manage Scilab's String read and write process using call_scilab and api_scilab
- API_Scilab: Double Reading — How to read matrices of double in a gateway.
- API_Scilab: Double Writing — How to write matrices of doubles in a gateway.
- API_Scilab: String Reading — How to read matrices of strings in a gateway.
- API_Scilab: String Writing — How to write matrices of string in a gateway.
Authors
Sylvestre Ledru
<< API call_scilab (moteur Scilab) | API call_scilab (moteur Scilab) | Complex management >> |