Octave
From Steak Wiki
Jump to navigationJump to search
Tips on GNU Octave
argv
# NOTE: numbers passed into argv are treated as (ascii) char # must convert with str2num, or some other e.g. (call script with ./script 20 #!/usr/bin/octave arg_list = argv(); HOWLONG=arg_list{1} # NOTE: numbers passed into argv are treated as (ascii) char # which means 0 is around 40 in binary. # must convert with str2num, or some other # cast() will not fix this (as it casts the binary) display("How long is: ") class(HOWLONG) news2 = str2num(HOWLONG) display("news2 is now: ") class(news2)
If Loop
#don't forget quotes on numbers here #if HOWLONG == "1" # SQLQUERYNUM = 288; #elseif HOWLONG == "3" # SQLQUERYNUM = 288 * 3; #elseif HOWLONG == "7" # SQLQUERYNUM = 288 * 7; #elseif HOWLONG == "14" # SQLQUERYNUM = 288 * 14; #else #display("incorrect time to search") #display("Try, 1, 3, 7, 14") #exit(); #en