Finding and accessing nested objects for export in System Composer Toolbox

1 view (last 30 days)
Hello all,
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
model.Architecture.Components(1, 1).Name
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 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.

Answers (1)

Josh Kahn
Josh Kahn on 21 Mar 2022
Edited: Josh Kahn on 21 Mar 2022
Hi there,
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!
Josh Kahn
Josh Kahn on 22 Mar 2022
Thanks for the update! Glad that you were able to work out a solution. By the way, was there any information missing from systemcomposer.exportModel or were you just looking for a custom format?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by