Comment my function in order to get a decent title in the documentation

조회 수: 86 (최근 30일)
Hello everyone,
I am in the process of figuring out how to comment adequately my function so that its html published version is easy to read for everyone. By that I mean that I would appreciate if it had a nice bold orange title, with a description underneath it and then the table of content for each section. The code as is generated by Matlab when creating a new function is:
function [curve] = historical_curve(index_name,id,date,starting_bin,nb_cont_bins,bin_length,method)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
When publishing without executing the code for performance purposes, it yields nothing . I tried the example in the documentation, but apparently I can only manage to get it working for this script, not my function.
I have tried adding up the "%% " before the title, it does not work.
Any ideas ? Thanks for reading this :)

채택된 답변

Brendan Hamm
Brendan Hamm 2015년 7월 28일
When publishing a function (just like with a script) the file is run, however with a function you require inputs. If you select "edit Publishing options" from the Publish drop down menu item you will have the opportunity to provide these. See attached screen shot.
My function requires 2 inputs, so I create these in the "MATLAB expressions" section and call my function. You will note that your function will be called on this line by default, but without input arguments.
  댓글 수: 5
Brendan Hamm
Brendan Hamm 2015년 7월 28일
Ok. One thing you way want to consider is having all of the publication text before the function declaration. Now you will not have this problem. Often times you would not want to include the actual code in the documentation, so I have turned this off as well.
Vincent
Vincent 2015년 7월 28일
I tested out your solution and it works perfectly fine. I think I'l stick to that then. It's pretty weird though; once I get more than two section title above the function definition, I don't have the above mentioned problem.
Anyway, thanks a lot for helping me out !

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by