control properties of app designer components from a Matlab function block of a Simulink model
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mauricio Bassallo
el 29 de Oct. de 2021
Respondida: Reshma Nerella
el 8 de Nov. de 2021
Hi,
I would like to control the properties of some app designer components using a Matlab function block of my Simulink model. Is that possible? In case yes, could you provide how can I do it?
Thanks in advance for your comments.
Regards,
Mauricio
0 comentarios
Respuesta aceptada
Reshma Nerella
el 8 de Nov. de 2021
Hi,
From my understanding you want to control the components of an app from Simulink function block.
1.Create a function and add the code for modifying the required components properties. For example
function output = func1(input)
coder.extrinsic('func1') %add this line to bypass code generation and to not get the same message as error
if isempty(app) || ~isvalid(app)
app = app1; % create an instance of app
end
app.MessageEditField.Value = "Hello from Simulink!"; % Modify the properties
2. Call this function from the MATLAB function block of your Simulink model.
function y = fcn(u)
coder.extrinsic('func1')
y = func1(u);
Hope this helps!
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Subsystems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!