How do I execute Powershell scripts in MATLAB?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 23 de Mayo de 2011
Editada: MathWorks Support Team
el 2 de Sept. de 2025 a las 7:14
I can run Powershell scripts from MATLAB with the following syntax:
!powershell 2*10; echo 'This is a line'
However I need to press the Enter key to return to the MATLAB Command Prompt. This makes it impossible to use Powershell script from a MATLAB function or script as it needs user interaction to continue the execution of the function or script. I would like to let the Powershell command return by itself.
Respuesta aceptada
MathWorks Support Team
el 2 de Sept. de 2025 a las 0:00
Editada: MathWorks Support Team
el 2 de Sept. de 2025 a las 7:14
The Powershell application calls ReadLine() on a redirected STDIN after executing a script. Since MATLAB redirects STDIN, you need to press Enter to continue.
There is a workaround to let the Powershell application return immediately. You can pass the following input argument:
-inputformat none
For example:
!powershell -inputformat none 2*10; echo 'This is a line'
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!