problem to run system(''.exe) on Mac

조회 수: 18 (최근 30일)
erasmo mancusi
erasmo mancusi 2012년 1월 28일
답변: Walter Roberson 2017년 2월 10일
Hi to All I have recently migrate to MacosX 10.7.2 from windows and I use Matlab 2009b.
On my mac when I try to run a system command (equivalently bang or unix) appears the following error:
>system('myprogram.xe')
bin/bash/ myprogram.exe command not found.
Really I do not know how to strart to fix this problem any help suggestion is welcome.
erasmo

채택된 답변

Daniel Shub
Daniel Shub 2012년 1월 28일
It is extremely unlikely that any file ending in .exe will run on anything OS other than Microsoft Windows. You need to find the version of the program written for OS X .
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 1월 28일
Either that or you need to specify which Windows you are co-hosting, such as Parallels. If you have a something like Parallels then it might be possible to fire up a .exe in the co-hosted operating system.
rob
rob 2016년 3월 5일
i'm exactly trying to run a windows file, using parallels, with the system function. But no results.
Any help? Thank you in advance

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

erasmo mancusi
erasmo mancusi 2012년 1월 28일
Ok! It's not possible to run an exe file in a different suystem but the commands "system" "bang" , "unix" and "dos" too do not work n Matlab (on MACOSX) even if I trie to run an application file generate in the same operative system. Any suggestion is appreciate. Erasmo
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 1월 28일
You might be having path problems. Try
!echo $PATH
and check to see whether the directory that has the program is listed in the PATH. If it is not then you will either need to adjust the shell path or name the directory explicitly.

댓글을 달려면 로그인하십시오.


erasmo mancusi
erasmo mancusi 2012년 1월 30일
편집: Walter Roberson 2017년 2월 9일
Hi, thanks for your help. I solved the problem installing wine on MAC and the command is
system('wine myprogram.exe')
thx
  댓글 수: 1
Javier de la Torre Costa
Javier de la Torre Costa 2017년 2월 9일
Hi I am interested in this problem but I don't understand the solution you give, could you explain me more detailed pls?

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2017년 2월 10일
For Parallels on the Mac:
  • first start a virtual machine
  • now use one of the two methods described at http://osxdaily.com/2013/08/08/change-default-application-open-files-mac-os-x/ to indicate that you either want to open the particular .exe with Parallels Desktop or that you want to always open all .exe with Parallel Desktop. Note: you might have difficulty selecting "always open with" if the file resides on a Windows partition as it will probably say you do not have permission.
  • Now, inside MATLAB, to run the executable, system() an 'open' command naming the .exe . You can pass it arguments using --args . For example,
system('open matlab.exe --args -r "disp('hello');quit"')
Instead of setting up parallels as the default application, you should be able to use open with the -a or -b options. More information on those flags is at http://brettterpstra.com/2014/08/06/shell-tricks-the-os-x-open-command/

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by