How to filter view on Comments inside of Requirements Toolbox
28 views (last 30 days)
Show older comments
I'm using MATLAB R2023b Update 6 (not sure what the Requirements Toolbox version is).
Could someone please help me create a view that filters on the comment field that includes any amount of text?
Specifically, I want to make a view and filter on items that have a comment present as shown below.
MATLAB documentation (slreq.Requirement - Work with requirement objects - MATLAB) says that the property Comments is an array structure. The fields of the Comments struct are Comments.CommentedBy, Comments.CommentedOn, Comments.CommentedRevision, and Comments.Text.
I am trying to filter using Comments.Text but I cannot figure it out. The filter I made that doesn't work is:
{"Comments.Text:~=" , ""};
The error that I receive is "Error applying Requirements view filter: No such attribute." I have also tried many different permutations to no avail.

0 Comments
Answers (1)
Josh Kahn
about 2 hours ago
Please let me know if this gets you what you need:
allReqs = slreq.find("Type", "Requirement");
emptyComments = cellfun(@isempty, {allReqs.Comments});
idList = strjoin({allReqs(emptyComments).Index}, "|");
selectionString = compose("^%s$", idList);
{"Index:regexp", selectionString};
0 Comments
See Also
Categories
Find more on Author Requirements 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!