Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function headers #2

Closed
kthyng opened this issue Jul 23, 2020 · 3 comments
Closed

Add function headers #2

kthyng opened this issue Jul 23, 2020 · 3 comments

Comments

@kthyng
Copy link
Contributor

kthyng commented Jul 23, 2020

Related to JOSS review.

Opening on behalf of @chadagreene. This comment was originally here.

@lnferris as I mentioned, it will be a few weeks before I can focus on a detailed review, but based on a quick glance through the .m files, one request I will have is that each function be given a header that can be accessed by typing help myfunction into the command line. Ideally, I'd like to see either .mlx or .html files with rich documentation as well so users can see and follow along with examples, but for starters it's important to at least include headers for every function.

If you want to get started on that now, I recommend following the template of official Matlab documentation, listing Syntax, Description, and Examples. The Syntax is generally a list of all the different ways users can specify inputs. The Description section describes in words what each type of syntax does and when you might want to use it. And provide a couple of Examples, starting with the simplest case scenario and then getting more complex. The Examples are good not only to help users learn how to use your functions, but the Examples also serve as reliable tests to ensure your function is working as expected. Here's a dummy template:

function b = myfunction(a,varargin)
% myfunction magically transforms a into b. 
% 
%% Syntax
% 
%  b = myfunction(a) 
%  b = myfunction(a,'Option',Value)
% 
%% Description 
% 
% b = myfunction(a) converts a into b. Input a can be any MxN matrix
% containing numerical values. 
%  
% b = myfunction(a,'Option',Value) specifies a value of an optional
% input 'Option'. By default, Value is 0, but may be set to any finite
% scalar value. 
% 
%% Example 1
% Determine the value of b if a equals five: 
% 
%  a=5; 
%  b=myfunction(a)
%
%% Example 2
% Convert a 5x4 matrix of values of a into b, and specify an Option  
% value of 16: 
% 
%  a=rand(5,4); 
%  b=myfunction(a,'Option',16)
%
%% Citation Info 
% Link to your GitHub here. 
% 
% See also myotherfunction and myotherotherfunction.
@lnferris
Copy link
Owner

lnferris commented Jul 23, 2020

I added help-accessible added headers (Syntax, Description, Examples, Info) to all functions. 👍

@lnferris
Copy link
Owner

@kthyng do I close issues once fixed or do I let reviewers decide whether to close them? Thanks!

@kthyng
Copy link
Contributor Author

kthyng commented Jul 24, 2020

Ideally wait until @chadagreene is working on his review so he can give feedback and then close after you've both agreed it's finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants