Opening file with external application fails

조회 수: 1 (최근 30일)
Nicolas
Nicolas 2014년 4월 21일
댓글: Walter Roberson 2014년 4월 22일
Hi,
I'm attempting to open a file with an external application by calling system as follows:
[status, results] = system('open -a myExtApp path/to/filename.extension')
This results in the applicaiton (myExtApp) to bounce a couple time on my deck, then it disappears. The app fails to launch, although status is 0.
If I type
open -a myExtApp path/to/filename.extension
straight from terminal, then it does launch the file fine.
Any help would be appreciated... Thanks!
N

채택된 답변

Walter Roberson
Walter Roberson 2014년 4월 21일
At the terminal, give the command
printenv
and in MATLAB give the command
system('printenv')
and compare the two. Look in particular at PATH and any variable starting with LD_ or DYLD_
On my OS-X system, in addition to changes to PATH, I see DYLD_FRAMEWORK_PATH and DYLD_LIBRARY_PATH set within MATLAB but not set at the terminal. You might need to do something like,
system('unset DYLD_FRAMEWORK_PATH DYLD_LIBRARY_PATH; open -a myExtApp path/to/filename.extension')
  댓글 수: 2
Nicolas
Nicolas 2014년 4월 21일
Yes! Thank you very much. Could you tell me what happens when I unset these variables? How does it prevent the app from launching? I wasn't able to gather much info on this. Thanks!
Walter Roberson
Walter Roberson 2014년 4월 22일
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html
It will take me a bit of time to write up an explanation.

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

추가 답변 (0개)

카테고리

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