How do I redirect "help" output to text file within iterative loop?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I would like to execute "help fxn_name{jj}" from with a loop and redirect all output to a text file.
Below is an excerpt of my code. fid_in is a report from depfun() that has a list of "m-files". I want to read each member of the list and execute "help" on that function, then write name and the corresponding "help" info to fid_out.
This sets up depfun properly:
[list,builtins,classes,prob_files,~,eval_strings,called_from] = depfun(fun,'-toponly','-print',ofilename);
I use outputs of depfun to perform the following:
for jj=1:numfiles,
tline=fgetl(fid_in) %processing already done to remove unneeded info.
fxn_name{jj}=tline(lastslash+1:end);
fxn_name_path{jj}=which(fxn_name{jj});
fxn_name_index{jj}=num2str(find(ismember(list,fxn_name_path{jj})));
fprintf(fid_out,'%i',str2num(fxn_name_index{jj}));
fprintf(fid_out,' %s',fxn_name{jj});
str=['help ' fxn_name{jj}];
fprintf(fid_out,'%s',eval(str));
end
MATLAB's "help" command is unique and seems to be the source of my problem.
Suggestions?
0 个评论
采纳的回答
更多回答(1 个)
Derek
2014-2-21
编辑:Walter Roberson
2014-2-21
2 个评论
Walter Roberson
2014-2-21
"help" is putting the strong in there. You can see it when you use "help" at the command line. evalc() is capturing exactly what help() is writing.
Time to break out the regexprep()
It appears that <strong> is obeyed anywhere in console output. I have not tracked to see what else is obeyed.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!