Misbehaving function on first call

John W. Eaton jwe at bevo.che.wisc.edu
Tue Oct 28 12:03:55 CDT 2008


On 28-Oct-2008, Søren Hauberg wrote:

| tor, 23 10 2008 kl. 10:43 +0200, skrev Søren Hauberg:
| >   I have the following function (this is the smallest example I've been
| > able to produce):
| [snip]
| 
| Okay, so this problem has really been annoying me. I've been able to
| track it down a bit further. The following function
| 
|   function weird ()
|     tmp = dir ("*.m");
|     [dir, name, ext] = fileparts ("weird.m");
|   endfunction
| 
| produces the following error
| 
|   error: invalid matrix index = 109
|   error: called from:
|   error:   /home/sh/Dokumenter/octave/octave-hg/octave/weird.m at line
| 2, column 7
| 
| But if I rename the first output argument of the 'fileparts' call to
| 'dirname', i.e.
| 
|   function weird ()
|     tmp = dir ("*.m");
|     [dirname, name, ext] = fileparts ("weird.m");
|   endfunction
| 
| the function runs with no problems.

I checked in the following change.

BTW, Matlab will not allow your original definition of this function
because you are using the same symbol as a function and later as a
variable.

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20081028/e6b4f07f/attachment.ksh 


More information about the Bug-octave mailing list