[help] converting a simple C code to Scilab

classic Classic list List threaded Threaded
3 messages Options
Alessandro Schmitt Alessandro Schmitt
Reply | Threaded
Open this post in threaded view
|

[help] converting a simple C code to Scilab

Hi, how would this be written using scilab?

   int vet[10];
   int i=0;

   do
   {
       vet[i]=i;
       i++;
   }
   while (i<5);

    printf("%i",vet[3]); //prints the number 3

Thanks.
Mike Page Mike Page
Reply | Threaded
Open this post in threaded view
|

Re: [help] converting a simple C code to Scilab

Hi,

vet = 1:4;
disp (vet(3));

will do almost the same thing.  But note that Scilab indices start at 1, not
zero, so vet does not include the element vet[0] = 0;

HTH,
Mike.


-----Original Message-----
From: users [mailto:[hidden email]]On Behalf Of
Alessandro Schmitt
Sent: 02 May 2014 00:41
To: [hidden email]
Subject: [Scilab-users] [help] converting a simple C code to Scilab


Hi, how would this be written using scilab?

   int vet[10];
   int i=0;

   do
   {
       vet[i]=i;
       i++;
   }
   while (i<5);

    printf("%i",vet[3]); //prints the number 3

Thanks.



--
View this message in context:
http://mailinglists.scilab.org/help-converting-a-simple-C-code-to-Scilab-tp4
030411.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4577 / Virus Database: 3931/7425 - Release Date: 05/01/14

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Alessandro Schmitt Alessandro Schmitt
Reply | Threaded
Open this post in threaded view
|

Re: [help] converting a simple C code to Scilab

Worked perfectly, thank you.