Getting the Matlab Plugin Working with TeXmacs

My impression is that you need only to press the green button (and maybe some other button after that!) to submit the pull request.

For the Windows part: IMHO it will be necessary to prepare the plugin for Windows as well (that the software works for the users is more important than our preferences IMHO), but please do not feel pressed to do that yourself. I would need some time to figure how to do it.

Giovanni

You’re right about the batch file for windows, I guess. And thanks that you’re willing to do that one of these days.

As it says

… wants to merge 2 commits into texmacs:master from …

on Github, I suppose the pull request is opened. Thanks again for your help.

Cheers, Tilda

1 Like

I am guessing that I have a chance—if it is too complicated, I will give up :slight_smile:

@pireddag,

isn’t there a bash shell for windows? If so, windows users might then be quite happy with our shell script.

Tilda

As far as I understand (just read on the Internet), that system allows one to install a Linux distribution within Windows. We would like to run the Windows version of Matlab through the Windows version of TeXmacs, which is a different thing.

I have been able to do something, and figured out that Matlab for Windows does not set the path based on the MATLABPATH environment variable—it does use that variable, but only to figure out where its own toolboxes are, I will write about this in more detail.

The command with addpath should then work, I still need to test it.

Said this, I have another concern about the shell script for Linux. What happens to the MATLABPATH environment variable if we stop and restart a Matlab session from the same TeXmacs document, or if we start several instances of TeXmacs from the same shell process? Do we get duplicated strings of $PLUGIN_CODE_PATH in it? If so, should we prevent it?

I don’t think so, export should only pass variables to child processes. E.g. you can test putting

export PATH=$PATH:/bin/test
echo $PATH

in a bash script. It will append to your PATH, but when it returns, you can check with another echo $PATH that it is untouched.

1 Like

@pireddag, @jeroen,

my impression is that once Matlab is launched, the plugin-startup script in not run again, irrespective of how often Matlab commands are executed from within TeXmacs files.

Yes, that’s generally correct @Tilda. Normally only one MATLAB session is launched. However, there is a function in TeXmacs to kill that session and restart it. This can for example be useful if your code is stuck in an infinite loop. In this case the session startup code would be re-run the next time you enter a command.

@jeroen

If the process is dead, it needs to be Bourne again :wink: As I previously mentioned, it’s not such a good idea to terminate a Matlab process within TeXmacs, at least not on OSX. To avoid “abnormal termination” due to a “segmentation violation” creating matlab_crash_dump.xxxx-y -files in $HOME, it’s probably better to kill Matlab on the operating system level.

Congratulations on the accepted pull request :slight_smile:
I am preparing the documentation that I said @sadhen I would (I am using your— @Tilda — demo file for that and I will ask you something, I imagine the internal messaging system of the forum is ok for these questions)