Run Something.sh file from matlab

82 次查看(过去 30 天)
Rajitha Dehigaspitiya
回答: Dario 2024-7-19,7:32
I want to run .sh file from the matlab . I have tried following way but its giving the permission denied error.
system('/home/scripts/Something.sh')
/bin/bash: /home/scripts/Something.sh: Permission denied
  1 个评论
Jan
Jan 2016-5-2
And can you run it from the shell directly? Who is he owner and is the executable flag activated?

请先登录,再进行评论。

回答(3 个)

Walter Roberson
Walter Roberson 2016-5-2
system('sh /home/scripts/Something.sh')

DanielFromIllinois
DanielFromIllinois 2022-3-14
If you're running this from Windows (not mac or linux) I got this to work by doing:
system('C:\Apps\Git\git-bash.exe Something.sh')
The above assumes that Something.sh is in your current directory within MATLAB. You could provide an absolute path like:
system('C:\Apps\Git\git-bash.exe C:\Users\UserName\home\scripts\Something.sh')

Dario
Dario 2024-7-19,7:32
Hello everyone,
do someone know if there is a way to do the same but in simulink? because created a matlab function block calling the sysrem function but it does not work, i tried to 'coder.extrinsic' the fuction but it seems that it does not work either.

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by