How to filter view on Comments inside of Requirements Toolbox
34 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Josh Kahn
2025 年 10 月 23 日 20:32
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!