P-ファイルにヘルプを含ませることはできますか?

5 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 3 月 23 日
回答済み: MathWorks Support Team 2018 年 3 月 23 日
PCODEを使用して MATLAB 関数を P-ファイルに変更し、オリジナルのプログラムファイル(.m)を削除しました。しかしそのため、このファイルのヘルプの情報にアクセスすることができません。
 

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 3 月 23 日
P-ファイルはMATLABの処理内容は含むことができますが、ヘルプの内容は含むことはできません。HELPコマンドを使用する際には、MATLABはヘルプの内容を表示するために.mファイルは検索しますが、.pファイルは検索しません。 
pファイルのヘルプを表示するための方法としましては、.mファイルから.pファイルを生成する際に、ヘルプの内容のみを含む.mファイルを生成します。 
以下の関数では、.mファイルからヘルプの記述の部分のみを抜き出し、元のファイル名の先頭に「_」をつけて保存します。このファイルを.pファイルとともに配布します。 
%--------------------------- 
function help2file(fname) 
% HELP2FILE extract the help informations from a MATLAB file and save it separately 
% the help information will be saved with the same name but using an underscore as a prefix. 
mhelp = help(fname); 
fname = [strrep(fname,'.m','') '.m']; 
fid = fopen(['_' fname],'w'); 
fwrite(fid,['%' strrep(mhelp,sprintf('\n'),sprintf('\n%%'))], 'char'); 
fclose(fid); 
%--------------------------- 
 
 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!