scilab: modify arrays example
This commit is contained in:
parent
310b5e4408
commit
139d74759d
1 changed files with 13 additions and 4 deletions
|
|
@ -638,6 +638,15 @@ For example with two global arrays x and y:
|
|||
%inline %{
|
||||
int x[10];
|
||||
double y[7];
|
||||
|
||||
void initArrays()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
x[i] = 1;
|
||||
for (i = 0; i < 7; i++)
|
||||
y[i] = 1.0f;
|
||||
}
|
||||
%}
|
||||
</pre></div>
|
||||
|
||||
|
|
@ -648,19 +657,19 @@ Following is an example of use of these functions:
|
|||
<div class="targetlang"><pre>
|
||||
--> exec loader.sce
|
||||
|
||||
--> x_set([0:9]);
|
||||
--> initArrays();
|
||||
--> x_get()
|
||||
ans =
|
||||
|
||||
0 1 2 3 4 5 6 7 8 9
|
||||
1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
|
||||
|
||||
--> y_set([0:6] / 7);
|
||||
--> y_set([0:6] / 10);
|
||||
--> y_get()
|
||||
|
||||
-->
|
||||
ans =
|
||||
|
||||
0. 0.1428571 0.2857143 0.4285714 0.5714286 0.7142857 0.8571429
|
||||
0. 0.1 0.2 0.3 0.4 0.5 0.6
|
||||
</pre></div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue