how to call system WSL to run executable on ubuntu

4 visualizaciones (últimos 30 días)
Daniele
Daniele el 25 de Sept. de 2023
Comentada: Daniele el 6 de Oct. de 2023
Dear Community!
I am working with MATLAB R2023a on Windows 10.
Recently, I have been compiling and running an executable (hydrological model) within WSL on Ubuntu 22.04.2 LTS (the executable cannot be compiled on Windows machines).
Now, I need to run the executable n times to carry out a sensitivity analysis. I have a script that runs in MATLAB.
I could install MATLAB also on Ubuntu and that is an easy solution for my task.
What I do not know how to do it, and for this I would really appreciate your help in the simplest words possible, is to call the executable that runs on WSL from the MATLAB Command Window.
I have looked for solutions in many forums but with no luck. As a trial, from this link "https://it.mathworks.com/matlabcentral/answers/473127-how-to-pipe-redirect-output-of-a-command-in-windows-subsystem-for-linux-wsl-to-another-using-a-sys" I ran
system('wsl bash -c "ls /mnt/c/ | tail -n 1"')
and I got
W
ans =
-1
as well as
system('bash -c "ls /mnt/c/ | tail -n 1"')
and I got
Windows Subsystem for Linux has no installed distributions. Distributions can be installed by visiting the Microsoft Store: https://aka.ms/wslstore
ans =
1
So the first did not work, and the second asked to install a Linux distribution, although I have it.
Any experience to make it work?
  6 comentarios
Shivang
Shivang el 6 de Oct. de 2023
Hi Daniele,
As you were able to run commands directly in the Linux shell as well as the Windows Command shell, the problem might be related to your MATLAB setup.
I would suggest contacting MathWorks support and creating a Technical Support request for further assistance: https://www.mathworks.com/support/contact_us.html
Best, Shivang
Daniele
Daniele el 6 de Oct. de 2023
Hi Shivang,
I will do that.
Thank you so much for your help.
Daniele

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by