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 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Ajuda Scilab >> call_scilab API > creadmat (obsolete)

creadmat (obsolete)

Read a single double or a matrix of double from Scilab memory using call_scilab. Note that it is the default datatype in Scilab. Starting with Scilab 5.2, this function is obsolete. See API_Scilab: Double reading for remplacement.

int C2F(creadmat)(char *name, int *m, int *n, double *scimat, unsigned long name_len);

Arguments

name

The name of the future Scilab variable

m

Number of rows

n

Number of columns

scimat

The actual matrix of double (array of double). Note that it is going to be stored in Scilab columnwise.

name_len

The length of the variable name(fortran compatibility)

C2F

C2F is just a macro which provides to this function the ability to be called from fortran

Description

This help describes how to use the function creadmat.

Using this function will retrieve a variable called name from Scilab memory into a standard C double *.

Examples

/* Load the previously set variable B */
// See: modules/call_scilab/examples/basicExamples/readwritematrix.c
int rowB_ = 0, colB_ = 0, lp_ = 0;
double *matrixOfDoubleB = NULL;
int i = 0, j = 0;

char variableToBeRetrievedB[] = "B";

/* First, retrieve the size of the matrix */
C2F(cmatptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));

/* Alloc the memory */
matrixOfDoubleB = (double*)malloc((rowB_*colB_)*sizeof(double));

/* Load the matrix */
C2F(creadmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfDoubleB,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
     * expect */
    printf("%5.2f ",matrixOfDoubleB[i * rowB_ + j]);
   }
  printf("\n"); /* New row of the matrix */
 }

See Also

  • Call_Scilab — call_scilab is an interface which provides the ability to call Scilab engine from C/C++ code
  • api Scilab — api_scilab is the Scilab interface to read/write data from/to Scilab memory
  • 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.
  • SendScilabJob — Send a Scilab task from a C/C++ code (call_scilab)
  • StartScilab — Initializes and starts Scilab engine in Call Scilab
  • cwritemat — Write a single double or a matrix of double into Scilab memory using call_scilab. Note that it is the default datatype in Scilab. Starting with Scilab 5.2, this function is obsolete. See API_Scilab: Double writing for remplacement.
  • Double Management — How to manage Scilab's variable read and write process using call_scilab and api_scilab

Authors

Sylvestre Ledru

<< creadcmat (obsolete) call_scilab API cwritebmat (obsolete) >>

Copyright (c) 2022-2024 (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