Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Change language to: Français - Português - 日本語

Scilab help >> call_scilab API (Scilab engine) > cwritemat (obsolete)

# cwritemat (obsolete)

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.

`int C2F(cwritemat)(char *name, int *m, int *n, int *mat, unsigned long name_len);`

### Arguments

name

The name of the future Scilab variable

m

Number of rows

n

Number of columns

mat

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

Using this function will basically do the same as A=[ 1 3 4 2 ]; but straight into Scilab memory with call_scilab.

### Examples

```// This example shows how to write a Scilab matrix of double in Scilab engine
// * Write a matrix into Scilab
// * B=[1 4 2 3;
// *    3 9 8 2 ]
// * Note that it is done column by column

// StartScilab
double B[] = {1,3,4,9,2,8,3,2};   /* Declare the matrix */
int rowB = 2, colB = 4; /* Size of the matrix */
char variableNameB[] = "B";

C2F(cwritemat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); /* Write it into Scilab's memory */

printf("\n");
printf("Display from Scilab of B:\n");
SendScilabJob("disp(B);"); /* Display A */```

• 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
• Double Management — How to manage Scilab's variable read and write process using call_scilab and api_scilab
• creadmat — 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.

Sylvestre Ledru