- In MATLAB's “TestCase” class, there is no specific callback function available for directly modifying the content of a text editor attached to a plot in Data Inspector. However, you can achieve the desired functionality by using the “addTearDown” method of the “TestCase” class. Define properties for the plot handle and text editor in your class. To attach a text editor to a plot in MATLAB, you can use the “uieditfield” function to create a text field or text area, respectively. Then, you can position and customize the text editor as needed. The “addTearDown” method should be called after each test case has finished executing. You can use this method to update the content of the text editor based on the data from the Test Harness.
- If not the “TestCase” class, you can also use “matlab.unittest.plugins.DiagnosticsValidationPlugin”. You can generate a plot in Test Manager and retrieve the failed diagnostics. Then, identify the specific plot of interest and programmatically add a text editor to it. The text editor can be then filled with the desired content. This will enable you to analyse or annotate the plot further using Data Inspector in Test Manager.
- “addTearDown” function: https://www.mathworks.com/help/releases/R2023a/matlab/ref/matlab.unittest.testcase.addteardown.html
- “uieditfield” function: https://www.mathworks.com/help/releases/R2023a/matlab/ref/uieditfield.html?searchHighlight=uieditfield&s_tid=doc_srchtitle
- “matlab.unittest.plugins.DiagnosticsValidationPlugin” class: https://www.mathworks.com/help/releases/R2023a/matlab/ref/matlab.unittest.plugins.diagnosticsrecordingplugin-class.html?searchHighlight=DiagnosticsRecordingPlugin&s_tid=doc_srchtitle