XLSread issue: works in command window but not form m file

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

XLSread issue: works in command window but not form m file

Harm Ubbens
Dear reader,

When I use xlsread from the command window in Octave 5.1.0 it works properly, however when I use the same commands from within an m-file it does not work and gives and out of bound error (see screenshots in attachment).

What can this problem be and how can I solve this?

Thanks,
Harm



m-file.PNG (39K) Download Attachment
CommandWindow.PNG (109K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XLSread issue: works in command window but not form m file

Dmitri A. Sergatskov


On Thu, Jan 9, 2020 at 8:39 AM Harm Ubbens <[hidden email]> wrote:
Dear reader,

When I use xlsread from the command window in Octave 5.1.0 it works properly, however when I use the same commands from within an m-file it does not work and gives and out of bound error (see screenshots in attachment).

What can this problem be and how can I solve this?

Don't ever call your programs (in octave or otherwise) "test" or anything similarly generic.
Call it "test1" if you must.

 

Thanks,
Harm


Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: XLSread issue: works in command window but not form m file

PhilipNienhuis
Dmitri A. Sergatskov wrote
> On Thu, Jan 9, 2020 at 8:39 AM Harm Ubbens &lt;

> harmubbens@

> &gt; wrote:
>
>> Dear reader,
>>
>> When I use xlsread from the command window in Octave 5.1.0 it works
>> properly, however when I use the same commands from within an m-file it
>> does not work and gives and out of bound error (see screenshots in
>> attachment).
>>
>> What can this problem be and how can I solve this?
>>
>
> Don't ever call your programs (in octave or otherwise) "test" or anything
> similarly generic.
> Call it "test1" if you must.

Good advice, but when I try it with an .xlsx file in a subdir "test" on my
Windows 7 desktop it works fine.

The bug occurs in fileparts.m, a core Octave function. As core Octave
functions in stable releases rarely give problems I'm inclined to think
something is wrong inside your Octave installation.
Restart Octave?
Reboot?
Reinstall Octave?
(no I don't advice to reinstall Windoze).

Philip




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: XLSread issue: works in command window but not form m file

Harm Ubbens
In reply to this post by Dmitri A. Sergatskov
Dear Dmitri,

Thank you for your reply on my issue. I have changed all the generic names but still encounter the same problem: I can load the excel file from the command window but not from an m-file with the same commands. 
When I did run the m-file the 'current directory changes' and then it does not work properly anymore. Whenever I launch the m-file from the current start-up directory (C:\Users\harm_) it does work. So changing current directory gives the error. 

Do you have an idea how to solve this?

Thanks,
Harm

Op do 9 jan. 2020 om 15:10 schreef Dmitri A. Sergatskov <[hidden email]>:


On Thu, Jan 9, 2020 at 8:39 AM Harm Ubbens <[hidden email]> wrote:
Dear reader,

When I use xlsread from the command window in Octave 5.1.0 it works properly, however when I use the same commands from within an m-file it does not work and gives and out of bound error (see screenshots in attachment).

What can this problem be and how can I solve this?

Don't ever call your programs (in octave or otherwise) "test" or anything similarly generic.
Call it "test1" if you must.

 

Thanks,
Harm


Dmitri.
--


Reply | Threaded
Open this post in threaded view
|

Re: XLSread issue: works in command window but not form m file

PhilipNienhuis
Please reply below the text, not top posting please.

See below


Harm Ubbens wrote

> Dear Dmitri,
>
> Thank you for your reply on my issue. I have changed all the generic names
> but still encounter the same problem: I can load the excel file from the
> command window but not from an m-file with the same commands.
> When I did run the m-file the 'current directory changes' and then it does
> not work properly anymore. Whenever I launch the m-file from the current
> start-up directory (C:\Users\harm_) it does work. So changing current
> directory gives the error.
> <snip>

You can load the m-file in the editor, add a breakpoint and step through it.
[*]
When at the line of a function call, click the "Step in..." button rather
than the "Next" button.
That way you can follow what the variable "filename" morphs into. I'm
curious why it would be 268 characters long.

Philip

[*] Maybe debug-stepping through a script doesn't work in 5.1.0. In that
case, make it into a function.



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html