summaryrefslogtreecommitdiffstats
path: root/scilab/modules/call_scilab
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2010-01-22 15:23:38 +0100
committerSylvestre Ledru <sylvestre.ledru@scilab.org>2010-01-22 15:23:38 +0100
commit4b2f0fef631d6689bd8148acff19a4f3f5bc2954 (patch)
tree1af85df3ab29856191d01802f61d2dfb6f851394 /scilab/modules/call_scilab
parentf384667475eaa025814139bb56b41fe441d1f71a (diff)
downloadscilab-4b2f0fef631d6689bd8148acff19a4f3f5bc2954.zip
scilab-4b2f0fef631d6689bd8148acff19a4f3f5bc2954.tar.gz
Example updated to use api_scilab
Diffstat (limited to 'scilab/modules/call_scilab')
-rw-r--r--scilab/modules/call_scilab/help/en_US/ComplexManagement.xml33
1 files changed, 29 insertions, 4 deletions
diff --git a/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml b/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
index 900708d..bcfa0c4 100644
--- a/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
+++ b/scilab/modules/call_scilab/help/en_US/ComplexManagement.xml
@@ -53,12 +53,25 @@
53 * Note that it is done column by column 53 * Note that it is done column by column
54 */ 54 */
55 55
56double B[]={1,3,4,9,2,8,3,2,1,0,-1,0,1/2,42,0,0}; /* Declare the matrix */ 56
57double B[]={1,3,4,9,2,8,3,2};
58double B_img[]={1,0,-1,0,1/2,42,0,0}; /* Declare the matrix */
59
60/*
61 * Prior to Scilab 5.2:
62 * double B[]={1,3,4,9,2,8,3,2,1,0,-1,0,1/2,42,0,0};
63*/
64
57int rowB=2, colB=4; /* Size of the matrix */ 65int rowB=2, colB=4; /* Size of the matrix */
58char variableNameB[] = "B"; 66char variableNameB[] = "B";
59 67
60C2F(cwritecmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB)); /* Write it into Scilab's memory */ 68/* Write it into Scilab's memory */
69createNamedComplexMatrixOfDouble(pvApiCtx,variableNameB,rowB,colB, B, B_img);
61 70
71/*
72 * Prior to Scilab 5.2:
73 * 2F(cwritecmat)(variableNameB, &rowB, &colB, B, strlen(variableNameB));
74 */
62printf("\n"); 75printf("\n");
63printf("Display from Scilab of B:\n"); 76printf("Display from Scilab of B:\n");
64SendScilabJob("disp(B);"); /* Display B */ 77SendScilabJob("disp(B);"); /* Display B */
@@ -69,16 +82,28 @@ int rowB_ = 0, colB_ = 0, lp_ = 0;
69int i = 0,j = 0; 82int i = 0,j = 0;
70 83
71double *matrixOfComplexB = NULL; 84double *matrixOfComplexB = NULL;
85double *matrixOfComplexB_img = NULL;
72char variableToBeRetrievedB[] = "B"; 86char variableToBeRetrievedB[] = "B";
73 87
74/* First, retrieve the size of the matrix */ 88/* First, retrieve the size of the matrix */
75C2F(cmatcptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB)); 89readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, NULL, NULL);
90
91/*
92 * Prior to Scilab 5.2:
93 * C2F(cmatcptr)(variableToBeRetrievedB, &rowB_, &colB_, &lp_, strlen(variableToBeRetrievedB));
94 */
76 95
77/* Alloc the memory */ 96/* Alloc the memory */
78matrixOfComplexB = (double*)malloc((rowB_*colB_*2)*sizeof(double)); 97matrixOfComplexB = (double*)malloc((rowB_*colB_*2)*sizeof(double));
98matrixOfComplexB_img = (double*)malloc((rowB_*colB_*2)*sizeof(double));
79 99
80/* Load the matrix */ 100/* Load the matrix */
81C2F(creadcmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfComplexB,strlen(variableToBeRetrievedB) ); 101readNamedComplexMatrixOfDouble(pvApiCtx, variableToBeRetrievedB, &rowB_, &colB_, matrixOfComplexB, matrixOfComplexB_img);
102
103/*
104 * Prior to Scilab 5.2:
105 * C2F(creadcmat)(variableToBeRetrievedB,&rowB_,&colB_,matrixOfComplexB,strlen(variableToBeRetrievedB) );
106 */
82 107
83printf("\n"); 108printf("\n");
84printf("Display from B formated (size: %d, %d):\n",rowB_, colB_); 109printf("Display from B formated (size: %d, %d):\n",rowB_, colB_);