How do I create relative paths for functions packaged into Apps?

2 ビュー (過去 30 日間)
Meade
Meade 2016 年 4 月 13 日
コメント済み: Meade 2016 年 4 月 15 日
I have created a programmatic gui that will be deployed to our team through the 'Package App' functionality. This gui has help calls to a folder of HTML Help files that I created outside of Matlab. However, since the user folder structure will obviously vary from computer to computer, how do I robustly reference their paths.
I'm guessing this will have something to do with the ctfroot command to ID where the user installed the App, but the help documentation is pretty vague.
Any help is greatly appreciated!
Exemplar code:
function helpCallback(CurrMouseOverObj,~)
page = CurrMouseOverObj; % Passed into function
path = 'C:\Users\JohnQ\Documents\Help'; % Need to make this relative
web(fullfile(path,[page,'.html']),'-new') % HTML pages & uicontrol tags have same name
end

回答 (1 件)

Yuebin Zhou
Yuebin Zhou 2016 年 4 月 15 日
Would putting another field on the GUI which enables users to specify the path themselves be a good idea?
  1 件のコメント
Meade
Meade 2016 年 4 月 15 日
@Yuebin Zhou Good thought, but then the user would have to copy/install the help files separately since they would not be accessible within the packaged app.
I would like to make this as transparent to the user as possible.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by