Matlab creating help but ignoring the header

3 visualizaciones (últimos 30 días)
Cameron
Cameron el 18 de Sept. de 2014
Comentada: Oleg Komarov el 18 de Sept. de 2014
Hi, I am writing a MATLAB package (classes, functions, etc.). I've been adding documentation below the first line of code. e.g. Below 'classdef' or 'function'. When you type help 'someClass' it works fine automatically generating the help information.
Now, I'm trying to add a header (the same header) to all of my files. I add this as a comment above the 'classdef' or 'function' line. But when I type help 'someClass', it displays just the header not the help info.
What can I do??

Respuestas (1)

Oleg Komarov
Oleg Komarov el 18 de Sept. de 2014
The help should be a continuous block of comments. This means that the classdef or function declarations constitute a termination of the block of comments.
For instance, you can do:
% H1 line Bla Bla
%
% Syntax ...
%
% Examples
%
% See also
%
function
But not :
% H1 line Bla Bla
function
%
% Syntax ...
%
% Examples
%
% See also
%
  2 comentarios
Cameron
Cameron el 18 de Sept. de 2014
Right, I understant that. This is what I have going on:
% mwave - A water wave and wave energy converter computation package
% Copyright (C) 2014 Cameron McNatt
% This program is free software: you can redistribute it and/or modify..
function [Forces, T, Beta, Modes] = Wamit_read2(folderpath, runname, rho, g)
% reads WAMIT .2 output file
% returns the diffraction forces (Forces), the periods (T), the headings
% (Beta), and the Modes (Modes)
So, the header is the comments above
function [] = Wamit_read2(),
and the help are the comments below. But when I type
help Wamit_read2
I get the header comments, not the help comments.
Oleg Komarov
Oleg Komarov el 18 de Sept. de 2014
Which part of the "you cannot do that" is not clear? It has to be a continuous block of comments.
Usually the structure of a help in Matlab is:
% H1 line
% Syntax
% Examples
% See Also
% Copyright/contact info
The H1 line, is what you call header. HAS to be on one line. The copyright is usually not displayed in the help, since the line break, but it's up to you really.

Iniciar sesión para comentar.

Categorías

Más información sobre Operators and Elementary Operations en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by