- regexprep: https://www.mathworks.com/help/releases/R2023a/matlab/ref/regexprep.html
- erase: https://www.mathworks.com/help/releases/R2023a/matlab/ref/erase.html
- strrep: https://www.mathworks.com/help/releases/R2023a/matlab/ref/strrep.html
How can I get plain text from test "Description" property from Simulink Test?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 10 Feb 2023
Edited: MathWorks Support Team
on 6 Oct 2025 at 17:28
I'm trying to read description text from my Simulink Test test file and all formatting is coming through as if it is an XML text.
A description in test manager can use bold, italic text, bulleting, etc. The output below is from an example with all different formatting used.
When I run these commands in the command window:
tf = sltest.testmanager.TestFile('example_tf')
tf.Description
the resulting description text looks like this:
'Example description text:<br /><br />Newline, <b>bold</b>, <i>italyc</i>, <u>underline </u>and <strike>strikethrough </strike>text<br /><ul><li>bulleting</li><li>is</li><li>also</li><li>affected </li></ul>'
Is it possible to read/convert this as plain text - to preserve only newlines and to discard other formatting when I load it into the base workspace?
Accepted Answer
MathWorks Support Team
on 6 Oct 2025 at 0:00
Edited: MathWorks Support Team
on 6 Oct 2025 at 17:28
As of MATLAB R2023a, the functionality to retrieve the plain text of the description from Simulink Test is not available.
Instead, to remove the formatting, post process the formatted text using functions such as "erase", "regexprep", or "strrep" and reassign the output string to the object. Please refer to the following documentation pages for additional information:
An example of using "erase":
>> filterOut = ["<br />","<b>","</b>","<i>","</i>","<u>","</u>","<strike>","</strike>","<li>","</li>","<ul>","</ul>"]; % List of formats to remove
>> tf.Description = erase(tf.Description,filterOut)
tf =
TestFile with properties:
Name: 'example_tf'
FilePath: 'C:\Users\astepane\OneDrive - MathWorks\Documents\MATLAB\case sandbox\example_tf.mldatx'
Dirty: 1
Requirements: [0×1 struct]
Description: 'Example description text:Newline, bold, italyc, underline and strikethrough textbulletingisalsoaffected '
Enabled: 1
Tags: [0×0 string]
This allows you to define which formats to exclude. "Erase" will just remove the string, so to replace some of the formatting strings with spaces or new line characters, you can instead use "strrep" or "regexprep".
0 Comments
More Answers (0)
See Also
Categories
Find more on Outputs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!