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

3 次查看(过去 30 天)
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?

回答(1 个)

Ashutosh Thakur
Ashutosh Thakur 2023-12-21
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.

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by