Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - 日本語

Change language to:
English - Français - Português

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Scilab help >> call_scilab API > cwritecmat (obsolete)

cwritecmat (obsolete)

Write a single complex or a matrix of complex into Scilab memory using call_scilab. Starting with Scilab 5.2, this function is obsolete. See API_Scilab: Complex double writing for remplacement.

int C2F(cwritecmat)  (char *name, int *m, int *n, double *mat, unsigned long name_len);



The name of the future Scilab variable


Number of rows


Number of columns


The actual matrix of complex (array of double). Note that it is going to be stored in Scilab columnwise and the second half of the array is used for complex values.


The length of the variable name (fortran compatibility)


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


This help describes how to use the function cwritecmat.

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


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

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

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

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

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: Complex double reading — How to read matrices of double in a gateway.
  • API_Scilab: Complex 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
  • Complex Management — How to manage Scilab's complex variable read and write process using call_scilab
  • creadcmat — Read a single complex or a matrix of complex from Scilab memory using call_scilab. Starting with Scilab 5.2, this function is obsolete. See API_Scilab: Complex double reading for remplacement.


Sylvestre Ledru

<< cwritechain (obsolete) call_scilab API cwritemat (obsolete) >>

Copyright (c) 2022-2023 (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:13:00 CEST 2011