SCILAB Script - 12 Days of Christmas

Messages about other areas of TRIUS expertise (Energy, Radiation Safety, Risk,..) and Technology, in general...
Post Reply
User avatar
Evan Tromblay
Casual User
Casual User
Posts: 13
Joined: Wed Oct 26, 2011 7:00 pm

SCILAB Script - 12 Days of Christmas

Post 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
User avatar
Fedya Rovic
Active User
Active User
Posts: 41
Joined: Wed Oct 26, 2011 7:16 pm

Re: SCILAB Script - 12 Days of Christmas

Post by Fedya Rovic »

Interesting, but how about posting any more practical pieces of code?
"Everybody gets so much information all day long that they lose their common sense", G. Stein
User avatar
GradPhys
Frequent User
Frequent User
Posts: 57
Joined: Tue Nov 15, 2011 3:07 pm

Re: SCILAB Script - 12 Days of Christmas

Post 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.
User avatar
Dale Valenti
Casual User
Casual User
Posts: 12
Joined: Wed Nov 02, 2011 8:23 pm

Re: SCILAB Script - 12 Days of Christmas

Post 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!
Post Reply