Azzera filtri
Azzera filtri

Directing MATLAB to a bash script and executing that script in Unix (NOT MATLAB)

1 visualizzazione (ultimi 30 giorni)
I am running MATLAB on windows 10 OS but I also have a virtual desktop of Unix OS. The only thing that links these two OS is that they share a couple of drives where files that I created in Unix. I can have MATLAB read them, process the data and write to the same folder. But I have a couple of bash scripts that I would like MATLAB to point to and execute them in Unix. Is there any way to do this beside me using SSH commands or is this my only option?

Risposte (1)

Ashutosh Thakur
Ashutosh Thakur il 21 Dic 2023
Hi Justin,
I can understand that you would like to execute bash scripts in Unix OS using MATLAB which is present in Windows OS.
Following are the suggestions which could help you in achieving the above objective:
  • The Recommended way to execute a script on a Unix system from a Windows system is via SSH. MATLAB supports SSH through the use of "system" command. This allows you to execute OS commands using MATLAB.
  • Another way is to set up a network service such as HTTPS in Unix system which listens for the requests to execute these bash scripts. Now you can use "webwrite" or "webread" functions in MATLAB which writes data to the RESTful web service from Windows and these bash script would be executed in Unix.
  • Another alternative is you can use Windows Subsystem for Linux (WSL) which allows you to run Unix like environment directly from windows without dual booting the system. In this case you can execute bash scripts in Unix using MATLAB present in windows.
You can take reference from the following documentation links for the reference:
I hope this helps!
Thanks.

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by