help-octave
[Top][All Lists]
Advanced

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

Re: Why doesn't pause work in function? Why errors from plot?


From: Ben Abbott
Subject: Re: Why doesn't pause work in function? Why errors from plot?
Date: Mon, 20 Feb 2012 13:48:48 -0500

On Feb 20, 2012, at 12:38 PM, J Stasko wrote:

> Sorry to be so obtrusive, but I need help!!!  Thanks!
> 
> ~~~~~~~~~~PROBLEM STATEMENT:
> 
> I have actually two problems.
> 
> -> My .m file does  *not*  pause when it comes to the "pause"
> statement.  Why is this?
> -> plot gives me an error where there is no error.
> 
> ***********
> ~~~~~~~~~~FUNCTION WHICH CAUSES PROBLEM:
> Here is the function:
> 
> 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
> 
> ************
> ~~~~~~~~~~~OUTPUT:
> Here is 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>
> 
> *****************
> ~~~~~~~~~~~VERSION INFORMATION:
> 
> Here is my version information (yes, it's a new load from macports)
> 
> 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>
> 
> Ben also asked,
> 
> octave-3.4.0:4> which plot
> `plot' is a function from the file
> /Applications/Octave.app/Contents/Resources/share/octave/3.4.0/m/plot/plot.m
> 
> *************
> ~~~~~~~~~~HISTORY:
> Ben recommended I try this and I still get an error:
> 
> 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
> 
> **************
> 
> Dima had the following comment:
> 
> 
>>> I suspect a more general problem
>>> 
>>> John -- does the following code work on your machine ?
>>> 
>>> a = rand(200);
>>> b = inv(a)*a;
>>> trace(b)
>>> 
>>> Dmitri.
> 
> But this works, b is 200:
> 
> ***********************************PLEASE HELP*************************
> 
> Thanks!!!
> 
> -John

I like Dimitri's suggestions.

My guess is that you have a script named "pause.m" that assigns the variable 
"x" some value.

Please try the attached version of plottrack.m and let us know what happens.

Ben


Attachment: plottrack.m
Description: Binary data





reply via email to

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