help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question re: argv()


From: Rhys Ulerich
Subject: Question re: argv()
Date: Sun, 19 Jun 2011 10:46:17 -0500

Hi all,

I'm having trouble understanding some argv()-related behavior.  This
is likely me not grokking argv()'s resulting cell arrays well.

Given an executable script called 'confusion' which is intended to
just pull arguments from a command line:

#!/usr/bin/env octave
h   = argv(){1}
Ah  = argv(){2}
sh  = argv(){3}
s   = sh / h
Ahs = argv(){4}
th  = argv(){5}
t   = th / h
Aht = argv(){6}

I run the script as 'confusion 8 0.0176197 16 0.00873737 32 0.00849534' and see

h = 8
Ah = 0.0176197
sh = 16
s =

   0.87500   0.96429

Ahs = 0.00873737
th = 32
t =

   0.91071   0.89286

Aht = 0.00849534

which completely baffles me.  How exactly does 16 / 8 = [0.875,
0.96429] ?  What do I need to do to obtain 16 / 8 = 2?

I've tried indexing like args(){3,[1]} and saving argv() into a
temporary with no luck.  I'm on version 3.2.3.

Any help appreciated,
Rhys


reply via email to

[Prev in Thread] Current Thread [Next in Thread]