How to access subfunction headers with "help" command?

조회 수: 1 (최근 30일)
Marshall
Marshall 2014년 11월 14일
편집: per isakson 2015년 1월 12일
Hallo userbase,
for the following situation, is it possible to print the subfunction header to the command window using help?
function foo = myFunc(bar)
%MYFUNC
% A pointless function to demonstrate my question.
% @param <bar> input var
% @return <foo> output var
foo = mySubFunc(bar);
end % END myFunc
function foo = mySubFunc(bar)
%MYFUNC.MYSUBFUNC
% Here is some information about my very important and refactored subfunction.
foo = bar + bar;
end % END mySubFunc
If I punch in help myFunc :
>> help myFunc
myFunc
A pointless function to demonstrate my question.
@param <bar> input var
@return <foo> output var
But is there some way to access the subfunction header? Something like help myFunc.mySubFunc?
All the best, Marshall

채택된 답변

Adam
Adam 2014년 11월 14일
I'm fairly sure you can't. The subfunction is private to the file it is in so it has no outside visibility and shouldn't need it either since it cannot be called from outside of its parent file.
  댓글 수: 2
Marshall
Marshall 2014년 11월 25일
Huh, that's weird. Thanks for the reply!
I really thought I read something somewhere, or had done something. Must have been dreaming in code again...
Image Analyst
Image Analyst 2015년 1월 10일
I guess you'd need to make it a comment for it to appear, just like the other comments appear:
% function foo = mySubFunc(bar)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

per isakson
per isakson 2015년 1월 10일
편집: per isakson 2015년 1월 12일
"Something like help myFunc.mySubFunc?" &nbsp Yes, it's possible with R2013a (and earlier). Try
>> help cssm>sub_cssm
sub_cssm - subfunction of cssm
where
function cssm
end
function sub_cssm
% sub_cssm - subfunction of cssm
end

카테고리

Help CenterFile Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by