Is there a way to make the Matlab plug-in work on Windows?

Hi,
I’m trying to get the Matlab plug-in to work inside Texmacs in Windows, but I am not able to make it work. Is it even possible? I’m trying my best with my limited computer knowledge: .

Right now my tm_matlab file is a bat file that calls a PowerShell file:

@echo off
powershell -ExecutionPolicy Bypass -File “%~dp0\tm_matlab.ps1”

Powershell file:

TeXmacs control character

Write-Output ([char]2 + “verbatim:”)

Path to plugin folder

$pluginPath = “$env:TEXMACS_PATH\plugins\matlab\code”

Launch MATLAB: add plugin folder to path, then run tmrepl

matlab -nodesktop -nosplash -r “addpath(’$pluginPath’); tmrepl;”

Unfortunately when I try this and open a matlab session in Texmacs, a new Matlab console window opens instead of having a communication between matlab and Texmacs:

Inside Texmacs: Busy as always

Inside matlab console window:
matlab%20command%20prompt

So mister Gpt told me that:

  • On Linux/Mac, TeXmacs launches MATLAB via a shell, and stdin/stdout can be piped directly.
  • On Windows, Start-Process or launching MATLAB normally opens a separate console, breaking the pipe.

So is it possible to make the Matlab plug-in work on Windows?

Hi @pl-chartier and welcome to the forum. I remember that I tried briefly time ago making perhaps a small progress.

All record that I can find of that attempt are in the post at Getting the Matlab Plugin Working with TeXmacs

I don’t have immediately the time to work on this, and I do not read there anything related to getting Matlab on Windows to direct output to the shell. Bu perhaps you can find some hint there. I’m pinging @Tilda and @jeroen that might have some suggestions, although none of them uses Windows as far as I know.

Thank you for the welcome,
yes I am aware of the post and I tried your suggestion, but with no luck.

The command with addpath should then work

Dear @pl-chartier, as pointed out by @pireddag, I‘m not on Windows, so I can‘t really help you getting your powershell correctly calling the matlab pluglin.

matlab2025a works correctly on a recent macOS from within TeXmacs when the plugin is called by a bash shell, so installing that shell on Windows might be a way.

There seem to be several approaches. See https://www.windows-faq.de/2022/08/26/bash-unter-windows-11-installieren/ or https://gitforwindows.org/ and https://sps-lab.org/post/2024_windows_bash/ for instance.

You may want to do some research on the Internet to figure out which of the many options really works or suffices for you.

Cheers, Tilda