[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why doesn't pause work in a function
From: |
Ben Abbott |
Subject: |
Re: Why doesn't pause work in a function |
Date: |
Fri, 17 Feb 2012 14:45:37 -0500 |
On Feb 17, 2012, at 11:39 AM, J Stasko wrote:
>> 2012/2/15 Ben Abbott <address@hidden>:
>>>
>>> On Feb 13, 2012, at 7:02 PM, J Stasko wrote:
>>>
>>>> I didn't see this in the documentation... Here's my function code:
>>>>
>>>> function plottrack(x)
>>>> [slices,values] = size(x)
>>>> for i = 0 : ((values-3)/6)-2
>>>> i
>>>> pause
>>>> plot(x(:,(i*6)+4),x(:,(i*6)+5))
>>>> pause
>>>> endfor
>>>> endfunction
>>>>
>>>> Here's the output:
>>>>
>>>> octave-3.4.0:2> plottrack(snaps)
>>>> slices = 31
>>>> values = 183
>>>> error: plottrack: A(I,J): column index out of bounds; value 183 out of
>>>> bound 183
>>>> error: called from:
>>>> error: /Users/johns/Programming/diameter/plottrack.m at line 4, column 4
>>>> octave-3.4.0:2>
>>>>
>>>>
>>>> So really, there are two questions. One is why, when i = 28 the
>>>> calculation can yield a column index out of bounds...
>>>>
>>>> The other is, as I was trying to debug it using "i" and "pause", I
>>>> neither see the value for i nor do I get the pause on my display.
>>>>
>>>> Thanks for all the help!
>>>>
>>>> -John Stasko
>>>
>>> I tried
>>>
>>> plottrack (rand (31, 183))
>>>
>>> Both pause statements work and I encountered no errors.
>>>
>>> Ben
>>
>> ---------- Forwarded message ----------
>> From: J Stasko <address@hidden>
>> Date: 2012/2/15
>> Subject: Re: Why doesn't pause work in a function
>> To: Ben Abbott <address@hidden>
>>
>>
>> Weird. I get this:
>>
>> octave-3.4.0:3> plottrack(rand(31,183))
>> slices = 31
>> values = 183
>> error: plottrack: A(I,J): column index out of bounds; value 183 out of bound
>> 183
>> error: called from:
>> error: /Users/johns/Programming/diameter/plottrack.m at line 4, column 4
>>
>> The pause didn't stop the code and I got an error.
>>
>> -John
>
> _Hi,
>
> Sorry to post this again, please help...
>
> Here's my version:
>
> octave-3.4.0:1> ver
> ----------------------------------------------------------------------
> GNU Octave Version 3.4.0
> GNU Octave License: GNU General Public License
> Operating System: Darwin 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun
> 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
> ----------------------------------------------------------------------
> no packages installed.
> octave-3.4.0:2> system("uname -a")
> Darwin s-3.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7
> 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
> ans = 0
> octave-3.4.0:3>
I tried ...
plottrack (rand (31, 183))
... on SnowLeopard (Darwin 10.8.0) with Octave 3.4.0 from source forge. I
encountered no errors and obtain the same result as I did on Lion.
Any chance your Octave is using the wrong plot.m? What does "which plot" return
?
Ben