Finding and accessing nested objects for export in System Composer Toolbox
2 vues (au cours des 30 derniers jours)
I am currently working with the System Composer toolbox and am trying to implement an export of the data. The internal export is not sufficient for me and I would like to adjust the export according to the project characteristics.
System Composer provides me with a Architecture model or its object. This can then consist of components, which in turn can contain new architectures or components. In short, these are nested objects.
Normally, I would use for example
to query the name of this specific component, for example. I could then repeat this for other Components(1, n...) components inside of a loop. But how do I manage to process all components of all architectures?
My idea was based on https://www.mathworks.com/matlabcentral/fileexchange/57957-set-and-get-nested-structure-object-filed-data to find all components and output them as a list of strings. This appoach follows a recursive algorithm. Of course I would have to adapt this function. Then I would know at least the path of the objects.
How can I then call these objects in a loop based on my string vector/list?
Because MATLAB does not accept
model.Architecture.('Components(1, 3).Architecture.Components(1, 2).Name')
To make matters more complicated, some objects refer back to previous objects and thus form a loop. I.e. there is no lowest level. These must therefore be systematically excluded in the above approach.
Are there any other ideas I'm overlooking or other approaches that would make exporting the properties of the objects, for example, easier?
Thanks a lot for your help.
Josh Kahn le 21 Mar 2022
Modifié(e) : Josh Kahn le 21 Mar 2022
Hope you were able to figure out a solution that worked for you but if not, I think the find API with the AnyComponent query and the lookup API may get you the list for which you are looking.
System Composer Find with AnyComponent query constraint:
System Composer Lookup (use the paths returned from the query above):
I'd also be interested to hear what issues you ran into when using the systemcomposer.exportModel API.
Hope that helps!