
Comment my function in order to get a decent title in the documentation
83 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 :)
0 commentaires
Réponse acceptée
Brendan Hamm
le 28 Juil 2015
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 commentaires
Brendan Hamm
le 28 Juil 2015
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.

Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
