(clicked "reply" instead of "reply all" - OK now to octave-dev + Bill
Denney)
Hi Søren:
Søren Hauberg wrote:
> Hi
>
> Sorry about the horribly late reply.
>
> fre, 30 10 2009 kl. 22:10 +0100, skrev Philip Nienhuis:
>> In Octave script dateaxis.m I found a little bug + a leftover
debugging "keyboard" statement.
>
> This looks like a bug, so I've removed it.
>
>> It also invokes a stray gnuplot if called with too many arguments.
>
> I don't quite understand. Could you provide an example?
If I call dateaxis with -say- 4 arguments, I get an extra empty gnuplot
window. IIRC that's what the "return" statement I added around line 72
aims to fix.
(Unless it is intended behaviour to continue execution after a "usage"
warning.)
>> The bug is that argument "startdate" is actually ignored.
>
> I don't know the code very well, so I can't really comment on this. I
> see your change includes
>
> ticks = get (h, [ax "tick"]);
> - ticks = ticks - ticks(1) + startdate;
> + ## Added by PRN oct 2009
> + if (~isempty(startdate)) + ticks = ticks -
ticks(1) + startdate;
> + endif
>
> I don't, however, see what this does or how it relates your comment
> about 'startdate' being ignored. In the case where 'startdate' is empty
> the current code is the same as doing
>
> ticks = ticks - ticks (1);
>
> Isn't that okay?
(Hmmmm... for me it's also quite a while back....)
...but here it is. No it's not okay, at least on my octave-3.2.3_MingW:
(for clarity I renamed the original dateaxis.m to dateaxis_old.m)
I made a plot with with x-axis values ranging from 713396 to 719786.
Then, invoking dateaxis_old ('x'):
----------------------------------
octave-3.2.3.exe: #15 > dateaxis_old ('x')
error: operator +: nonconformant arguments (op1 is 1x8, op2 is 0x0)
error: called from:
error:
C:\Programs\Octave\3.2.3_gcc4.4.0\share\octave\packages\financial-0.3.2\dateaxis_old.m
at line 94, column 9
----------------------------------
So octave doesn't accept an empty value for startdate in the statement
ticks = ticks - ticks(1) + startdate;
To be more specific: "ticks = ticks - ticks[1] + []" is not accepted.
Not surprising if the dimension of startdate = 0, octave tries to index
it anyway but that is bound to fail.
The if statement I added is meant to work around that
"bug?/issue?/behaviour?".
Another solution *might* be to change line 43
"startdate = []"
into
"startdate = 0"
but I haven't tried that.
FYI, on the octave-3.0.3_MSVC binary I get similar errors:
----------------------------------
octave-3.0.3.exe:2> plot (H(336).values(:,1), H(336).values(:,2))
octave-3.0.3.exe:3> dateaxis_old ('x')
error: invalid matrix index = 1
error: evaluating binary operator `-' near line 94, column 17
error: evaluating binary operator `+' near line 94, column 28
error: evaluating assignment expression near line 94, column 9
error: called from `dateaxis_old' in file
`C:\Programs\Octave-3-0-3\share\octave\packages\financial-
0.3.0\dateaxis_old.m'
----------------------------------
(even more picky & verbose as regards dimensions of arrays to be added)
(But my modified dateaxis.m gives other errors later on (something like
"empty dimensions for mat2cell") that I ignored as v3.0.3 is outdated
now anyway)
I hope this is all clear enough?
Best wishes,
Philip
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev