Requirements Manager: How to extract information from the Custom Attribute Registry inside the Requirement Set class
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposta accettata
Pat Canny
il 20 Giu 2024
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.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!