Variables from Matlab App Workspace to Simulink without Matlab Workspace

Is it possible to pass variables form Matlab app workspace (a struct in matlab app made like this app.Workspace.Subworkspace.Variable), directly to Simulink, without using Matlab Workspace or an external file?

 Akzeptierte Antwort

Andreas Goser
Andreas Goser am 23 Sep. 2025
Yes, you can pass variables from a MATLAB app workspace directly to Simulink without using the MATLAB workspace or an external file. You can achieve this by using the Simulink.SimulationInput object to set parameters directly from your app's workspace.

4 Kommentare

Andreas Goser
Andreas Goser am 23 Sep. 2025
Bearbeitet: Andreas Goser am 23 Sep. 2025
More information here and depending on the release you have available also this.
Marco
Marco am 23 Sep. 2025
Bearbeitet: Marco am 23 Sep. 2025
thank you for your answer
Is it possible to compile lookup tables?
in the first example It seems I can only pass a variable containing a number.
Would it be possible to pass a vector or a matrix?
I am currently using matlab 2022a
As I found a few technical articles around detail problems around compiling lookup tables, I conclude this is generally possible. But I am ot an expert for this. I am happy to connect you with MathWorks staff to help you further. Can you send me a personal message for further conversation if you are interested?
@Andreas Goser Thank you, I managed to pass the variables and vectors form matlab app workspace to simulink.
% Create a SimulationInput object for your model
simIn = Simulink.SimulationInput('Your_Simulink_Model');
simIn = simIn.setVariable('Variable_name_in_Simulink', app.Workspace.Subworkspace.Variable);
If I will need further assistance I will send you a personal message!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 22 Sep. 2025

Kommentiert:

am 25 Sep. 2025

Community Treasure Hunt

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

Start Hunting!

Translated by