Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

One click open .m file in the octave GUI editor

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

One click open .m file in the octave GUI editor

  • Quote

Post by orion777 » Thu Jan 19, 2023 10:39 am

Hallo to everyone!

I'm using xfce 4.16 and octave 7.3.0-r2.

I would like to open the *.m files in the octave GUI interface by simply clicking on the *.m file.

I have tried:
octave --gui in the file open menu - but this cause m file code to run and then exit (no GUI appears)
octave --gui --persist in the file open menu - then, when I'm clicking on the *.m file, the file runs, the results (figures) opens and stay opened, the GUI opens too, but the GUI contains no *.m file code in the editor (the GUI editor remains empty).

I'm mostly working with a MATLAB on Windows computers; typically I'm starting the MATLAB by clicking onto the *.m files (these, typically, are on USB drives); I'm not starting the MATLAB first, and then searching the file through the matlab's explorer...
Top
mike155
Advocate
Advocate
Posts: 4438
Joined: Fri Sep 17, 2010 11:33 pm
Location: Frankfurt, Germany

  • Quote

Post by mike155 » Thu Jan 19, 2023 1:46 pm

'octave --help' prints:

Code: Select all

...
Usage: octave [options] [FILE]
...
FILE  Execute commands from FILE.  Exit when done
      unless --persist is also specified.
You could use option '--eval'. The command below opens a file in Octave's editor:

Code: Select all

octave --gui --persist --eval "edit /usr/share/octave/7.3.0/etc/tests/fixed/publish/test_script_example.m"
You could also open Octave and use drag&drop from Thunar (or a similar file manager) to open files in Octave's editor.
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Fri Jan 20, 2023 6:13 am

Thanks for the answer!

However, I still can't do what I want.

I would like to open any *.m file by double click on it (in the xfce environment).

If I press mouse right button, then
Open with then
Open with another application,
where in the field Use a custom command I enter /usr/bin/octave --gui --persist --eval
the double click on the *.m file opens the octave in the GUI mode, but the octave by itself returns an error in the Command Window

Code: Select all

error: parse error:

  syntax error

>>> /home/user/Desktop/hexa.m
    ^
>>
Top
mike155
Advocate
Advocate
Posts: 4438
Joined: Fri Sep 17, 2010 11:33 pm
Location: Frankfurt, Germany

  • Quote

Post by mike155 » Fri Jan 20, 2023 1:53 pm

Create a file ~/bin/octave_edit with the contents below:

Code: Select all

#!/bin/sh
octave --gui --persist --eval "edit '$1'"
Make it executable:

Code: Select all

chmod u+x ~/bin/octave_edit
Open Thunar, right click on a .m file, select 'open with', 'set default file' and select the script you created: 'octave_edit'. Don't forget to enable "Use as default for this kind of file".
Top
orion777
Apprentice
Apprentice
Posts: 207
Joined: Wed Mar 15, 2017 11:05 am
Location: Riga, Latvia

  • Quote

Post by orion777 » Fri Jan 20, 2023 3:07 pm

Yes, it works! Thanx a lot!!
Top
Post Reply

5 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic