Simulink.restoreDiagnostic
Restore diagnostic warnings to a specific block, subsystem, or model
Syntax
Description
Simulink.restoreDiagnostic(
restores
all suppressed diagnostics associated with the blocks specified by source
)source
.
Simulink.restoreDiagnostic(
restores
all instances of source
, message_id
)message_id
on the blocks specified
by source
.
Simulink.restoreDiagnostic(
restores
the suppressed diagnostics associated with diagnostic
)MSLDiagnostic
object diagnostic
.
Examples
Restore All Diagnostics for a Specified Block
To restore all suppressed diagnostics on a specified block, use getDiagnosticObjects.m
, suppressor_script.m
, and the Suppressor_CLI_Demo.slx
model. The getDiagnosticObjects.m
function queries the simulation metadata to access diagnostics that were thrown during simulation. The suppressor_script.m
script contains the commands for suppressing and restoring diagnostics to the Suppressor_CLI_Demo
model. Open the model. To access Simulink.SimulationMetadata
class, set the ReturnWorkspaceOutputs
parameter value to 'on'
. Simulate the model.
Create a cell array of message identifiers. Use the Simulink.suppressDiagnostic
function to suppress these multiple diagnostics from the Constant block, one
.
diags = {'SimulinkFixedPoint:util:fxpParameterPrecisionLoss',... 'SimulinkFixedPoint:util:fxpParameterUnderflow'}; Simulink.suppressDiagnostic('Suppressor_CLI_Demo/one', diags);
Remove all suppressions and restore diagnostics to the block.
Simulink.restoreDiagnostic('Suppressor_CLI_Demo/one');
Restore a Diagnostic for a Specified Block
To restore a suppressed diagnostic on a specified block, use getDiagnosticObjects.m
, suppressor_script.m
, and the Suppressor_CLI_Demo.slx
model. The getDiagnosticObjects.m
function queries the simulation metadata to access diagnostics that were thrown during simulation. The suppressor_script.m
script contains the commands for suppressing and restoring diagnostics to the Suppressor_CLI_Demo
model. Open the model. To access Simulink.SimulationMetadata
class, set the ReturnWorkspaceOutputs
parameter value to 'on'
. Simulate the model.
model = 'Suppressor_CLI_Demo'; open_system(model); set_param(model,'ReturnWorkspaceOutputs','on'); out = sim(model);
Use the Simulink.suppressDiagnostic
function to suppress the parameter precision loss warning thrown by the Constant block, one
.
Simulink.suppressDiagnostic('Suppressor_CLI_Demo/one',... 'SimulinkFixedPoint:util:fxpParameterPrecisionLoss');
Remove the suppression and restore diagnostics to the block.
Simulink.restoreDiagnostic('Suppressor_CLI_Demo/one',... 'SimulinkFixedPoint:util:fxpParameterPrecisionLoss');
Restore All Diagnostics for a Specified System
To restore all suppressed diagnostics on a specified subsystem, use getDiagnosticObjects.m
, suppressor_script.m
, and the Suppressor_CLI_Demo.slx
model. The getDiagnosticObjects.m
function queries the simulation metadata to access diagnostics that were thrown during simulation. The suppressor_script.m
script contains the commands for suppressing and restoring diagnostics to the Suppressor_CLI_Demo
model. Open the model. To access Simulink.SimulationMetadata
class, set the ReturnWorkspaceOutputs
parameter value to 'on'
. Simulate the model.
model = 'Suppressor_CLI_Demo'; open_system(model); set_param(model,'ReturnWorkspaceOutputs','on'); out = sim(model);
To restore all diagnostics from a system, use 'FindAll'
, 'on'
to search within the system hierarchy. Specify the system or system handle within which to search.
Simulink.restoreDiagnostic('Suppressor_CLI_Demo/Convert',... 'FindAll', 'On');
Restore All Diagnostics for a Specified Model
To restore all suppressed diagnostics on a specified model, use getDiagnosticObjects.m
, suppressor_script.m
, and the Suppressor_CLI_Demo.slx
model. The getDiagnosticObjects.m
function queries the simulation metadata to access diagnostics that were thrown during simulation. The suppressor_script.m
script contains the commands for suppressing and restoring diagnostics to the Suppressor_CLI_Demo
model. Open the model. To access Simulink.SimulationMetadata
class, set the ReturnWorkspaceOutputs
parameter value to 'on'
. Simulate the model.
model = 'Suppressor_CLI_Demo'; open_system(model); set_param(model,'ReturnWorkspaceOutputs','on'); out = sim(model);
To restore all diagnostics from a model, specify the model name or model handle.
Simulink.restoreDiagnostic('Suppressor_CLI_Demo','FindAll','on');
Input Arguments
source
— Block or model object throwing diagnostic
block path | block handle
The source of the diagnostic, specified as a block path, block handle, cell array of block paths, or cell array of block handles.
To get the block path, use the gcb
function.
To get the block handle, use the getSimulinkBlockHandle
function.
Data Types: char
| cell
message_id
— message identifier of diagnostic
message identifier | cell array of message identifiers
Message identifier of the diagnostic, specified as a character vector or a cell array of
character vectors. You can find the message identifier of warnings and errors thrown during
simulation by accessing the ExecutionInfo
property of the Simulink.SimulationMetadata
object associated with a simulation. You can also use
the lastwarn
function.
Data Types: char
| cell
system
— Name of subsystem or model
character vector
The subsystem name, subsystem handle, model name, or model handle specified as a character vector.
Data Types: char
diagnostic
— Diagnostic object
MSLDiagnostic
object
Diagnostic specified as an MSLDiagnostic
object.
Access the MSLDiagnostic
object through the ExecutionInfo
property
of the Simulink.SimulationMetadata
object.
Data Types: struct
Version History
Introduced in R2016b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)