Page 1 of 1

SCILAB Script - 12 Days of Christmas

Posted: Thu Dec 27, 2012 4:46 pm
by Evan Tromblay
Here is a sample script I found on-line a wile ago that shows the abilities of array manipulations in SCILAB. It produces all the verses of the 12 days of Christmas. Very interesting.

the_verses={'A partridge in a pear tree.'; 'Two turtle doves, and ' ;
'Three French hens, '; 'Four calling birds, ' ;
'Five golden rings, '; 'Six geese a laying, ' ;
'Seven swans a swimming, '; 'Eight maids a milking, ' ;
'Nine ladies dancing, '; 'Ten lords a leaping, ' ;
'Eleven pipers piping, '; 'Twelve drummers drumming, '};

the_days={'first';'second';'third';'fourth';'fifth';'sixth';
'seventh';'eighth';'ninth';'tenth';'eleventh';'twelfth'};

for day=1:12
printf('On the %s day of Christmas my true love gave to me:\n', the_days(day));
presents = the_verses(day:-1:1);
printf('%s\n', presents(:));
printf('\n');
end

Re: SCILAB Script - 12 Days of Christmas

Posted: Sun Dec 30, 2012 3:08 am
by Fedya Rovic
Interesting, but how about posting any more practical pieces of code?

Re: SCILAB Script - 12 Days of Christmas

Posted: Wed Jan 09, 2013 6:10 pm
by GradPhys
Fedya Rovic wrote:Interesting, but how about posting any more practical pieces of code?
Yeah, something more demonstrative of scilab's abilities in the context of this forum - energy, risk, safety, etc. would have been more interesting, I agree.

Re: SCILAB Script - 12 Days of Christmas

Posted: Tue Feb 05, 2013 2:23 pm
by Dale Valenti
GradPhys wrote:
Fedya Rovic wrote:Interesting, but how about posting any more practical pieces of code?
Yeah, something more demonstrative of scilab's abilities in the context of this forum - energy, risk, safety, etc. would have been more interesting, I agree.
There are hundreds, probably thousands of such scripts out there, Gradphys. A two minute search with google will find some in any specific application area you want!