Opening "external" files in a compiled Mac program

조회 수: 2 (최근 30일)
HpW
HpW 2024년 2월 6일
댓글: Image Analyst 2024년 3월 21일
Hello
I have a program that has a button to open an external .pdf file.
when I run via Matlab, I have the button call this code
system([sprintf('open %s',path)]);
where path is the name of the file to be opened, and this works fine.
I then compiled the program on Mac, and included the external files within the compiled executable.
However, when I run the program, nothing happens when I click the button
Can you help explain why this happens and how I can fix it? Do I somehow need to call the files differently if they reside within the compiled executable?
thanks!
  댓글 수: 1
Anton Kogios
Anton Kogios 2024년 2월 6일
Not too sure if this will work, but you may need to allow (full) disk access to the executable in System Preferences.

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

채택된 답변

Image Analyst
Image Analyst 2024년 2월 7일
  댓글 수: 2
HpW
HpW 2024년 3월 19일
This is what I ended up using to get it to work
path = fullfile(ctfroot,'progname',file);
ctfroot does not contain the files, but there is a folder one folder down from ctfroot (named something like your compiled program name) that does contain the files which are included in the compiled program.
thanks for the help!
Image Analyst
Image Analyst 2024년 3월 21일
Do not call your variable path since that is the name of a built-in variable.
See attached function that may be helpful to you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by