Can System Composer read parameters directly from JSON or XML?
Show older comments
Hello everyone,
I am currently working on a CubeSat design using System Composer and Simulink.
At the moment, I define parameters manually in the System Composer Model Workspace (using Model Explorer), and these parameters are then used in Simulink for analysis (e.g., orbit propagation and link budget).
I would like to improve this workflow by loading parameters automatically from an external file (e.g., JSON or Excel), instead of defining them manually.
My question is:
Is it possible to directly import parameters into System Composer from a structured file (such as JSON or XML), or is it necessary to use a MATLAB script as an intermediate step to read the file and assign the values to the Model Workspace?
Additionally, what would be the recommended workflow for managing parameters in a scalable way when working with multiple subsystems (e.g., COMM, ORBIT) in System Composer?
Thank you in advance.
Answers (1)
Umar
on 20 Mar 2026 at 9:48
Edited: Walter Roberson
on 21 Mar 2026 at 20:18
1 vote
Hey @Erica,
Great question — I've been down this rabbit hole before with System Composer, so hopefully I can save you some time!
To answer your core question directly: there's no built-in "import from file" button in System Composer's GUI. A MATLAB script as the middleman is always necessary — but once you set it up properly it's clean and barely noticeable in your daily workflow.
FILE FORMAT OPTIONS
If you're using Excel, readtable() does the heavy lifting. You load your sheet, loop through the rows, and call setParameterValue() on each component — maybe 10 lines of MATLAB total. MathWorks actually has an official example using the systemcomposer.io.ModelBuilder class to import an entire architecture from Excel:
JSON is equally simple — jsondecode() turns your file into a struct and you assign from there.
For XML (since you mentioned it): same idea using xmlread() or readstruct(). Just a heads-up though — System Composer does support importing SysML/AUTOSAR (ARXML) XML for full architectures from third-party tools, but that's a different beast from plain parameter XML files. Don't confuse the two.
THE EXPORT-FIRST TRICK
One thing that really helps before building your Excel or JSON file: run systemcomposer.exportModel() on your existing model first. It hands back a struct with a ready-made parameters table showing you the exact column format System Composer expects — no guesswork needed.
Then when you're ready to import, you pass everything back through systemcomposer.importModel():
For deeper reading on the full import/export workflow:
And specifically for the parameters side of things:
SCALING ACROSS SUBSYSTEMS (COMM, ORBIT, etc.)
For your multi-subsystem setup, I'd strongly recommend moving toward Simulink Data Dictionaries (.sldd). You can give COMM its own dictionary and ORBIT its own dictionary, then reference a shared global dictionary for common values — clean separation, no collisions. Parameters defined at the System Composer level sync through to your linked Simulink models automatically, so your orbit propagation and link budget simulations just pick them up.
The MathWorks guide on partitioning dictionaries across a model hierarchy is exactly what you need here:
And for doing it programmatically:
THE PRELOADFCN TRICK (game changer)
Once you have your init script reading from JSON or Excel, set it as the model's PreLoadFcn callback under Model Properties → Callbacks. Every time you open the model, it automatically reloads all parameters from your file — no more remembering to run the script manually. (The MathWorks partitioning guide above actually shows this pattern too, and how to remove it once you've fully migrated to a data dictionary.)
CUBESAT TEMPLATE
Lastly — MathWorks has a CubeSat MBSE project template built directly into System Composer's examples. It might already demonstrate some of these patterns:
(Search for "CubeSat" on that page — it's listed under the examples.)
Hope that helps — feel free to follow up if anything's unclear! Best of luck with the build.
1 Comment
Érica
on 21 Mar 2026 at 19:44
Categories
Find more on System Composer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!