Issues executing bash commands from matlab (windows 10)
11 次查看(过去 30 天)
显示 更早的评论
Hello all,
I have a question very similar to this one, regarding executing bash commands from the matlab command-line.
For context, I'm using MATLAB R2019a (9.6.0.1150989 Update 4) on Microsoft Windows 10 Pro Version 10.0.19041 Build 19041
The command I'm trying to execute is
! bash -c c:/nrn/bin/mknrndll
This gives me the output
0 [main] sh 20084 sync_with_child: child 20888(0x244) died before initialization with status code 0xC0000142
848356 [main] sh 20084 sync_with_child: *** child state waiting for longjmp
c:/nrn/bin/mknrndll: fork: Resource temporarily unavailable
When I start bash from the windows start menu (by typing in bash and pressing enter), I can cd to the folder in question and execute
bash-4.4$ c:/nrn/bin/mknrndll
which produces the expected output (a compiled .dll file from a bunch of .mod files, and some other extrania).
I can execute
! bash -c ls
from inside MATLAB without problems and recieve the expected output.
On closer inspection, this probably isn't strictly speaking a MATLAB issue because I get the same error if I first open cmd.exe, then start bash, then cd, then try mknrndll I get the same error from as within Matlab. Nevertheless, does anyone have any ideas what's going on here (and are there any other ways of executing a sh script on windows via Matlab?)
1 个评论
Rik
2021-6-11
The general idea with the command line from Matlab is that you should make sure your script runs as expected without any user interaction.
So you need to find a way to queue commands. It looks to me like you can simply queue the cd and your call with the normal bash syntax.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!