Opening an external file in a deployed application

Hello, I'm trying to figure out how I might include a help file with my packaged GUI program. I'd like to have a help button that when clicked opens a PDF that I've written. It's easy enough to use winopen when using matlab, but how do I make it do this with a deployed application?
I've tried including the PDF in with the other secondary files at the time of packaging but that doesn't work. It would appear the winopen function will use the current directory and not its internal directory or whatever it does when calling included .m files.

 채택된 답변

Titus Edelhofer
Titus Edelhofer 2013년 1월 30일

1 개 추천

Hi James,
you can use the function
ctfroot
zu build up an absolute path to where your .pdf is when packed into the application. Or, if the .pdf is in the same folder as the function calling it, you might do something like the following
folder = fileparts(mfilename('fullpath'));
winopen(fullfile(folder, 'mydoc.pdf'));
Titus

댓글 수: 3

Interesting. I didn't know about the ctfroot function. I believe I could use it for some other things I was trying to do. Thanks for the response.
I was actually able to resolve the issue by simply using open instead of winopen. I wouldn't have thought there was a difference, but it seems to work.
Hello James, Even I am facing the issues with same. Even open function is not opening pdf after deployment, can u please help me
The difference is: "open" is doing what MATLAB would do if you double click on it within MATLAB. winopen (if on Windows, of course!) does the action you would expect when double clicking within Windows explorer

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

질문:

2013년 1월 29일

댓글:

2018년 11월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by