⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 helpx.m

📁 实现地震勘探中
💻 M
字号:
function warnings=helpx(func)
% Run the example in the help section of a function
% The help section starts with the line "% EXAMPLE"


string=blanks(80);
string=strrep(string,' ','=');

helptext = help(func);
if isempty(helptext)
   warnings=['Function "',func,'" has no help section'];
   return
end

htext=tokens(helptext,char(10));
idx=strmatch('EXAMPLE',strtrim(htext));

if ~isempty(idx)
   if length(idx) > 1
      warnings=['Function "',func,'" has more than one EXAMPLE'];
   else
      label=['Example for "',func,'"  '];
      disp([label,string(1:80-length(label))])
      hhh=htext(idx+1:end);
      hhh=splice_continued_lines_no1(hhh);
      try
         evalc(cell2str(hhh,','))
      catch
         ple
         disp('Error while evaluating help example. Investigate or type "return" to continue.')
         keyboard
      end
      warnings='';
  end
else
   warnings=['Function "',func,'" has no EXAMPLE'];
end
if nargout == 0
   clear warnings
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function htext=splice_continued_lines_no1(htext)
%	Splice command lines that end in ...
for ii=length(htext)-1:-1:1
   temp=deblank(htext{ii});
   if length(temp) > 3
      while strcmp(temp(end-2:end),'...')
         temp=[temp(1:end-3),htext{ii+1}];
         htext(ii+1)=[];
      end
   end
   htext{ii}=temp;
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -