Requirements Manager: How to extract information from the Custom Attribute Registry inside the Requirement Set class

조회 수: 7 (최근 30일)
Hi all,
I have reached a good level of export requirements in the exel format using the guide indicated to me by the Matlab community: https://www.mathworks.com/help/slrequirements/ug/export-requirements-and-link-information-example.html
Now I would like to enrich the export by including the custom requirements. The method slreq.open('Name.slreqx') return me the requirement set structure but using the slreq.find() the custom attribute is not included. How can I achieve this, if it is possible? Thanks
Attached an image to show my sysReqSeqSet structure after running slreq.open('Req_TestMod_v2.slreqx') with two custom attributes added 'CustomAttributeNames', that I would like to export to the exel file along with the others.
Thank you in advance.

채택된 답변

Pat Canny
Pat Canny 2024년 6월 20일
You can get an array of CustomAttributeNames as a property of a Requirement Set, then use inspectAttribute to query the Information for a given Custom Attribute.
Here is a quick example leveraging the example from the inspectAttribute page in our documentation:
slreq.load('crs_req_func_spec');
rs = slreq.find('Type','ReqSet');
addAttribute(rs,'MyCheckbox','Checkbox','Description',...
'This checkbox attribute can be true or false.');
addAttribute(rs,'MyEdit','Edit','Description',...
'This is an Edit field');
customAttributeNames = string(rs.CustomAttributeNames)';
customAttributeInfo = arrayfun(@(x) string(inspectAttribute(rs,customAttributeNames(x)).description), 1:numel(customAttributeNames))';
tableForExport = table(customAttributeNames,customAttributeInfo,'VariableNames',["Custom Attribute", "Info"])
From here you can use writetable to export to Excel.
  댓글 수: 1
Luca
Luca 2024년 6월 21일
Thank you Pat, I understand your example that will be useful to me. I have to apologize though, I couldn't explain myself and focus on what I needed.
The canonical (slreq.Requirement) array structure of properties created within the reqXlsExport.m script through the slreq.find('Type','Requirement'); obviously not contain the fields of the my new custom requirements (requirement by requirement). Now i would to figure out how to extract the data associated to the my custom requirements values (requirement by requirement) if it is possible. After that i'll exported in the exel file, but this is another story. I hope I've explained myself better. Thank You.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by