doc command doesn't work in try/catch blocks

Hello,
I'm using the try/catch option. When I'm debugging the program and stop at a breakpoint, writing ' doc "function name" ' in the matlab command window causes a crash.
Is it a known bug?
Any way to resolve this issue?
Thanks,
Alex
[Edit: Moved more information from the answers - AU]
After further testing, it seems that the problem is somehow related to the function, but not its name or location. For now I wasn't able to reproduce the bug with other functions.
Below is the error I get:
??? Error: Unexpected MATLAB operator.
Error in ==> isClassMFile at 2 whichComment = regexp(evalc(helpUtils.makeDualCommand('which', fullPath)), '%.*', 'match', 'once');
Error in ==> splitClassInformation>resolveUnaryClass at 423 [isClassMFile, className] = helpUtils.isClassMFile(whichTopic);
Error in ==> splitClassInformation>unaryClassInformation at 401 [classInfo, whichTopic] = resolveUnaryClass(className, justChecking);
Error in ==> splitClassInformation>innerResolveImplicitPath at 128 [classInfo, whichTopic] = unaryClassInformation(objectParts, justChecking);
Error in ==> splitClassInformation>resolveImplicitPath at 104 [classInfo, whichTopic] = innerResolveImplicitPath(topic, implementor, justChecking);
Error in ==> splitClassInformation>innerSplitClassInformation at 44 [classInfo, whichTopic] = resolveImplicitPath(topic, implementor, justChecking);
Error in ==> splitClassInformation at 26 [classInfo, whichTopic, malformed] = innerSplitClassInformation(topic, implementor, justChecking, topicIsDotM);
Error in ==> doc>getClassInformation at 119 classInfo = helpUtils.splitClassInformation(topic, '', true, false);
Error in ==> doc at 88 [docTopic, isMethodOrProp] = getClassInformation(topic);
inside the function 'isClassMFile', first row, the function 'evalc' fails.
the output of: helpUtils.makeDualCommand('which', fullPath) is the line: which('C:\Program Files\MATLAB\R2010a\toolbox\matlab\iofun\sendmail.m')
and remarkably, when the path is the one for the function that causes problem, the output is: which(C:\Program Files\MATLAB\R2010a\toolbox\matlab\iofun\sendmail.m ) - the last comma is on a different line.
Any comment is welcome, Alex

1 件のコメント

Oleg Komarov
Oleg Komarov 2011 年 7 月 11 日
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

サインインしてコメントする。

 採用された回答

Alex Berkovich
Alex Berkovich 2011 年 7 月 12 日

0 投票

'which' function had a problem because one of the files had a name same as an internal Matlab function.

その他の回答 (3 件)

Jan
Jan 2011 年 7 月 11 日

1 投票

I cannot confirm this behaviour in Matlab 2009a 32bit, WinXP. Please post the Matlab and OS version you are using. And post an exact copy of the used command - I assume the double quotes are inserted for the posting only. And finally explain, what "crash" means, please. Di you get an error message, a wrong result or a crash dump?

2 件のコメント

Paulo Silva
Paulo Silva 2011 年 7 月 11 日
Jan my code doesn't work, is it a known bug? :)
Jan
Jan 2011 年 7 月 11 日
@Paulo: Yes, it is a none bug. But please define "code" and "my" with more details.

サインインしてコメントする。

Sean de Wolski
Sean de Wolski 2011 年 7 月 11 日

0 投票

try
error
catch
doc randi
end
works for for me, R2009b Mac64bit.
Walter Roberson
Walter Roberson 2011 年 7 月 11 日

0 投票

I wonder... what happens if you attempt to "doc" a .m file that has syntax errors? I don't think I've ever tried that.

3 件のコメント

Jan
Jan 2011 年 7 月 11 日
DOC uses HELP to extract the help text. HELP does not parse the contents of the M-file, but treats it as text file only and crops the initial commented block. Therefore syntax errors do not matter DOC.
But if the function WHICH is overloaded...
Alex Berkovich
Alex Berkovich 2011 年 7 月 12 日
Do you know what can cause 'which' to be overloaded? thanks.
Friedrich
Friedrich 2011 年 7 月 12 日
You can overload "which" when you write your own function called "which" which is on the MATLAB path. Maybe try this is ML:
>> which -all which
built-in (C:\Program Files\MATLAB\R2011a\toolbox\matlab\general\which)
C:\Program Files\MATLAB\R2011a\toolbox\simulink\simulink\@dependencies\which.p % dependencies method
>>

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by