MATLAB: Do I get an “Attempt to call a non-function value” error when implementing the example TLC script in the Real-Time Workshop 6.5 (R2006b) documentation

errorexamplescriptsimulink codertlc

The example TLC script given in the "Real-Time Workshop > Target Language Compiler > Code Generation Architecture > Code Generation Concepts > Records" section of the documentation should loop through a model and output the name of each block in the model. However, when I use the script I receive the following error:
Attempt to call a non-function value: IsModelReferenceSimTarget
Error: File: W:/archive/R2006b/perfect/matlab/rtw/c/tlc/lib\utillib.tlc Line: 2268 Column: 47
Breakpoint conditions must evaluate to a boolean result.
Error: File: W:/archive/R2006b/perfect/matlab/rtw/c/tlc/lib\utillib.tlc Line: 2268 Column: 22
Attempt to call a non-function value: IsModelReferenceSimTarget
Error: File: W:/archive/R2006b/perfect/matlab/rtw/c/tlc/lib\utillib.tlc Line: 2268 Column: 47
Breakpoint conditions must evaluate to a boolean result.
??? Error: File: W:/archive/R2006b/perfect/matlab/rtw/c/tlc/lib\utillib.tlc Line: 2268 Column: 22
Attempt to call a non-function value: IsModelReferenceSimTarget

Best Answer

This bug has been fixed in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
This is a bug in the Real-Time Workshop 6.5 (R2006b) documentation. The script that outputs the name of each block in a model should actually be as follows:
%addincludepath "matlabroot/rtw/c/tlc/lib"
%addincludepath "matlabroot/rtw/c/tlc/mw"
%addincludepath "matlabroot/rtw/c/tlc/blocks"
%assign Accelerator = 0 %%Needed to avoid error in utillib
%include "utillib.tlc"
%include "modelrefutil.tlc" %%Needed to avoid error in utillib
%selectfile STDOUT
%with CompiledModel
%foreach sysIdx = NumSystems
%assign ss = System[sysIdx]
%with ss
%foreach blkIdx = NumBlocks
%assign block = Block[blkIdx]
%<LibGetFormattedBlockPath(block)>
%endforeach

%endwith

%endforeach
%endwith