Run Selection in MATLAB from Linux Command Line - linux

I am running an SSH into a linux computer. The MATLAB GUI can be very slow and unresponsive. Is there a way I can use MATLAB in command line mode so that I can highlight part of my code and run that section? In GUI, it is possible to do this in the Editor window by right clicking and choosing 'Run Selection' or by pressing F9. In command line mode, I only know how to run the entire script.
In a similar vein, can I run a section of the code (the 'Run and Advance' button in the GUI) using command line?
Also, is it possible to see the workspace (like the Workspace window in the GUI version) from the command line?

AFAIK there is a no-desktop mode in MATLAB, which you can access by running it with -nodesktop parameter, this should provide you with what you need. You can find more info on official MATLAB pages

As Niemand said you can start MATLAB with the flag -nodesktop.
You won't be able to select and run a potion of code with -nodesktop. You could just put that chunk of code in a separate function or script and call that.
If you're doing a lot of work without the GUI I would recommend looking at http://matlab-emacs.sourceforge.net. This is a MATLAB mode for Emacs that provides many of the same functionalities as the MATLAB desktop.
Lastly check out who and whos to see the workspace variables.

Related

How to open a new terminal in VS Code from command line?

Is it possible to open a new terminal tab in VS Code from the command line? I know it's possible to have hotkeys and click the icon in the GUI. However, I need to do this from a script to have several terminals. I am running Ubuntu within a Docker devcontainer. I looked at the solution of using a terminal multiplexer, which might work, but it doesn't seem necessary.

How to bind keyboard shortcut to run command on selected file in linux?

I know how to set a keyboard command shortcut, that's easy, I just go to Applications > Settings > Keyboard and then click the Application Shortcuts tab within my Manjaro Linux system and set whatever command to whatever shortcut.
But how can I make it run that command on a selected file or selection of files?
Is there something I can change or add to the command to make it run on the file or files currently selected within my XFCE desktop environment?
Thanks!
Your approach would require to correlate your mouse position to your desktop and file-manager. Then you would need to have knowledge of the internal state. You then would need to display some GUI. This way of thinking in regards of programing is seriously wrong.
What you are looking for are context menu actions. So keep it that way.
You have files on your desktop or in the file-manager and can call user defined actions on one or more files. I think XFCE had something like Thunar. You may use caja wit caja --no-desktop and create some actions with caja-actions-config-tool. Gnome still has it, if you prefer Nautilus.

alt-tab like functionality when using terminal?

When working in GUI we do alt-tab (or cmd-tab in mac) to switch between multiple programs, for example I am writing a text file in a text editor and then I do alt-tab to switch to already running browser to google up something then I alt-tab again to come back to keep editing.
How do you perform such "switch between" programs in command line interface - for example working with a ssh command line shell?
EDIT: I forgot to mention it, I am using ssh to connect to my university's server, and they don't have screen & tmux installed, and my account have no right to install any new apps... Is there any built-in functionality to perform this task, or any work around? For exmaple can I "minimize" running proggram and come back to regular shell interface, do some work, then display the "minimized" process again?
Another workaround: use the shell's job control, eg if you're editing a file, CTRL-z pauses the editor and brings you back to the shell, where you can compile, see manpages, browse the web or whatever -- and of course you can background the browser or anything else.
Screen command offers the ability to detach a long running process (or program, or shell-script) from a session and then attach it back at a later time.
As a crude workaround, run multiple terminal windows on your computer, and alt-tab between them.
Incidentally, at the Linux console, you can switch virtual terminals with ctrl+alt+F for at least F1 through F6, commonly F8 or more (depends on how the distro sets them up). Not your case, I know, but in case future visitors should benefit.
If you are comfortable in Emacs, it allows you to run multiple independent ansi-term buffers.
You can also use "GNU screen" to emulate multiple terminals in one terminal.

Cygwin alway's interpreted with Ctrl-C

My cygwin terminal (known as Mintty) can't work, when I minimize it to the windows taskbar, and restore it, and it will receive the Ctrl-C signal, but i didn't touch any key.
This is wierd. when a long time command is running, i swith it to see wether is finishe, then it is interputed my Ctrl -C. I refresh intall it several times. it's still there.
This situation can also happened when i select some text on the terminal.
Thanks
Some translator software have the "Hyper Translate" function, which will copy texts selected then tries to translate it, the way how it copy strings is to simulate a Ctrl-C from keyboard. When using cygwin or some ssh/telnet terminal tools (e.g. SecureCRT, putty, NX Client..) and the Ctrl-C is not set as the hotkey for copy action, and you tries to select a block of texts, trouble comes.
I guess the one who asking this question is also a Chinese like me. Then, the famous software which will bring this trouble is "Youdao Dictionary".
Disabling the "Hyper Translate / HuaCiFanYi" function of the "Youdao Dictionary" is a remedy.
As Leif Zhang mentioned, if you are using Lingoes or other dictionary you should uncheck the option Translate Selected Text as the following image.

Is it possible to display multiple choice dialog in gVIM?

I have a gVIM script that parses current buffer and offers user to select one of multiple choices. It is implemented as console input, but since i'm using graphical version of gVIM, maybe it's possible to use graphical version of multiple choice dialog? I have tried to use python + Tkinter but it's very unstable and is not working on some NIX boxes :(. Any ideas?
GVim has, in its functions and settings, nothing that would enable showing GUI elements (with a few noble exceptions, like closing dialog and such.).
That being said, GVim is open source, and nothing stops you from downloading the source and messing with it.
After some research i have found a solution. VIM supports so-called "clientserver" mode and external application can send a command to it. So this task (and many others) can be solved with following technique (tested on Windows, OSX and Ubuntu):
VIMscript that handles a command launches standalone GUI script in
separate process and returns.
Standalone GUI script (python/ruby/.exe/whatever) displays GUI and
waits for user interaction.
After user interaction, standalone GUI script closes it's window,
communicates back to VIM via "clientserver" interface (call another
script, open file, move cursor etc) and exits.

Resources