필터 지우기
필터 지우기

custom class documentation question

조회 수: 1 (최근 30일)
mcg
mcg 2020년 4월 17일
댓글: Daniel Dolan 2020년 11월 11일
If I build a class in Matlab and type doc(class_name) the documentation comes up with information on the properties, methods, etc. of that class, somehow automatically generated from the .m code file itself. Is there a way to capture this in an .html file or a .m file that could be published into .html using publish()? With the help() command you can specify an output argument to capture the help as a character array (then fprintf() into a .m file and publish() it), but with doc() you cannot do this.
  댓글 수: 2
mcg
mcg 2020년 4월 17일
Well I at least figured out what Matlab is doing, to a point. Debug stepping through doc() it eventually gets the html with this command:
html = help2html(topic,'','-doc');
I can simply write this html to a text file, and it displays in Help or a web browser okay but the format is messed up, not pretty like what doc() spits out. If you continue passed this where the html string is created, it goes through a bunch of mumbo jumbo, pre-pending a 'text://' string to the html string, and finally gets to a nested function
doc() >> showHelpwin() >> helpwin() >> displayFile() >> web() >> openMatlabBrowser()
Inside of this function it calls
com.mathworks.mlservices.MLHelpServices.setHtmlText(html_file(8:end));
which is where the magic happens. But you can't step into this function, and you can't get an output from it. I think inside of here the html is being massaged to look nice, but I still don't see a way to capture the result. I can't even right click and "Get Page Source" because the result is blank.
Daniel Dolan
Daniel Dolan 2020년 11월 11일
com.mathworks.mlservices.MLHelpServices.setHtmlText is a static Java method.

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

답변 (1개)

Daniel Dolan
Daniel Dolan 2020년 11월 11일
You might take a look at the help2html function, located in the same directory as the doc function. It is an unsupported file and gould change at any time, so be wary.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by