Plot does not work well in Octave GUI in Windows

Dear team of Octave GNU,

I used to work with matrices and plot using EEGLAB. Many times I use Octave CLI, and it works fine in Linux. I have updated to Octave 6.4 few months ago for Windows to test new plugings in EEGLAB, and Octave GUI is not working to plot. I have tried installing again and also gnuplot, but it does not work with Octave GUI. I am just trying now this simple command

plot([1,2,3],[4,5,6]); 

I hope it will be easy to sort it out.
It works in Octave CLI, but it does not in Octave GUI giving the following results in command line.

>> plot([1,2,3],[4,5,6]);
error: parse error near line 163 of file C:\Program Files\GNU Octave\Octave-6.
4.0\mingw64\share\octave\6.4.0\m\plot\util\private\__add_default_menu__.m

  invalid parameter list

>>> function toggle_visibility_cb (hf, ~, hmenu, htb)
                                       ^
>> error: parse error near line 40 of file C:\Program Files\GNU Octave\Octave-
6.4.0\mingw64\share\octave\6.4.0\m\plot\util\gcbf.m

  syntax error

>>>   [~, fig] = gcbo ();
       ^
error: parse error near line 40 of file C:\Program Files\GNU Octave\Octave-6.4
.0\mingw64\share\octave\6.4.0\m\plot\util\gcbf.m

  syntax error

>>>   [~, fig] = gcbo ();
       ^
>> load PROeeg14.mat
>> open gcbf
error: parse error near line 90 of file C:\Program Files\GNU Octave\Octave-6.4
.0\mingw64\share\octave\6.4.0\m\miscellaneous\open.m

  syntax error

>>>   [~, fname, ext] = fileparts (file);
       ^

My system

  • OS: Windows 10 (version 2004)
  • Octave version: Version 6.4.0**
  • Installation method: e.g. Downloaded and installed “octave-6.4.0-w64-installer.exe” from Download

Thank you for the bug report :slightly_smiling_face:

Looking at the error messages, all related to the tilde character ~, it looks like a file encoding issue on MS Windows.

Do you use a Non-English MS Windows version / setting?

Pinging @mmuetzel, he knows probably more than me what went wrong.

~” is an ASCII character. Using it should work correctly with most encodings.
Anyway, could you please show what you get for the following commands in Octave?

__mfile_encoding__
__locale_charset__

Thank you very much for looking at my problem.
Yes, I am using a Spanish Windows and an English Linux Ubuntu.

Thank you very much, so maybe it is just to fix encoding in Octave?

>> __mfile_encoding__
ans = hz-gb-2312
>> __locale_charset__
ans = CP1252

That looks suspicious. ISTR that another user ended up with that (or a similar) encoding somehow. I wonder how that happened.
Try executing __mfile_encoding__ ('utf-8') at the command prompt and re-start Octave.
Does it work after that?

Edit: I just tried here and opened the preferences to the “Editor” panel and scrolled up and down with the mouse wheel. Once the mouse pointer ended up on top of the “Text encoding used for loading and saving” dropdown list, it no longer scrolled the panel. But it changed the selected encoding in the (“un-opened”) drop-down list.
I would probably not have noticed wouldn’t I have looked for exactly that list. Would I have searched for something else, I might not have looked at that box at all and ended up with a different .m file encoding.
Maybe that is what is happening for some users…

Edit2: @ttl: Is there a way to disable scrolling through the options of an “un-opened” drop-down list?

2 Likes

Dear M. Muetzel,
It worked well, I did exactly what you said, executing at command prompt and re-starting Octave. Then, I was able to open EEGLAB (blue window in the picture attached) and to make the single plot executing in command prompt, as seen in Figure 2 (right window in the picture attached)
Thank you very much for solving and teaching.
Carlos Mugruza.

>> __mfile_encoding__ ('utf-8')

>> figure; plot([1,2,3],[4,5,6]);   

@mmuetzel another suspicion I have is stale/incompatible settings right after upgrading Octave without altering the settings?

To my humble knowledge, there have been changes regarding detection/handling of the file encoding in Octave 6. Does this collide with files created in older Octave versions on Non-English systems?

I tagged all reports regarind the __mfile_encoding__ ('utf-8') solution as Topics tagged encoding.