Main Content

Block Path and Error Reporting Functions

LibBlockReportError(block, errorstring)

Use LibBlockReportError when reporting errors for a block. LibBlockReportError is designed to be used from block target files (e.g., the TLC file for an inlined S-function).

LibBlockReportError can be called with or without the block record scoped. To call the function without a block record scoped, pass the block record. To call the function when the block is scoped, pass block = [].

LibBlockReportError([],"error string")
  -- If block is scoped
LibBlockReportError(blockrecord,"error string")
  -- If block record is available

See LibBlockReportError in utillib.tlc.

LibBlockReportFatalError(block, errorstring)

Use LibBlockReportFatalError when reporting fatal (assert) errors for a block. Use LibBlockReportFatalError for defensive programming. Refer to Generating Errors from TLC Files.

See LibBlockReportFatalError in utillib.tlc.

LibBlockReportWarning(block, warnstring)

Use LibBlockReportWarning when reporting warnings for a block. LibBlockReportWarning is designed to be used from block target files (e.g., the TLC file for an inlined S-function).

LibBlockReportWarning can be called with or without the block record scoped. To call this function without a block record scoped, pass the block record. To call this function when the block is scoped, pass block = [].

LibBlockReportWarning([],"warn string")
--	If block is scoped
LibBlockReportWarning(blockrecord,"warn string)
--	If block record is available

See LibBlockReportWarning in utillib.tlc.

LibGetBlockName(block)

LibGetBlockName returns the short block path name string for a block record, excluding carriage returns and other special characters that can be present in the name.

See LibGetBlockName in utillib.tlc.

LibGetBlockPath(block)

LibGetBlockPath returns the full block path name string for a block record, including carriage returns and other special characters that can be present in the name. Currently, the only other special string sequences defined are '/*' and '*/'.

The full block path name string is useful when you are accessing blocks from MATLAB®. For example, you can use the full block name with hilite_system via FEVAL to match the Simulink® path name exactly.

Use LibGetFormattedBlockPath to get a block path suitable for placing in a comment or error message.

See LibGetBlockPath in utillib.tlc.

LibGetFormattedBlockPath(block)

LibGetFormattedBlockPath returns the full path name string of a block without special characters. The string returned from LibGetFormattedBlockPath is suitable for placing the block name, in comments or generated code, on a single line.

Currently, the special characters are carriage returns, '/*', and '*/'. A carriage return is converted to a space, '/*' is converted to '/+', and '*/' is converted to '+/'. Note that a '/' in the name is automatically converted to a '//' to distinguish it from a path separator.

Use LibGetBlockPath to get the block path for MATLAB functions used in reference blocks in your model.

See LibGetFormattedBlockPath in utillib.tlc.

Related Topics