How to send a value to position "i" from app designer to a constant block in Simulink that has 5 dimmensions?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Luis Pantin
el 21 de Jul. de 2020
Comentada: Luis Pantin
el 21 de Jul. de 2020
Hello all,
I am creating an app with MATLAB App Designer that interfaces with Simulink. I am able to send values from the app using the set_param command. For example, to send a value to a 1D constant block in Simulink I use this line of code:
set_param('nameOfModel/nameOfBlock','Value',5);
Now, since I a sending a lot of values to different constant blocks, I was thinking creating one single 5D constant block, and pass different values to each position of this block. I have tried several things with no luck.
Does anybody know a way to making this work or maybe using another approach?
Thanks for the help!!
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 21 de Jul. de 2020
It certainly can be done but I am not sure if it would be "better". Note you have to set 'Value' as '5', not 5.
when you set the value, you have to use
set_param(Block,'Value', mat2str(1:5))
when you try to modify the 3rd value, you have to do several steps
Value=get_param(Block,'Value');
Mat=str2double(Value);
Mat(3)=30;
set_param(Block,mat2str(Mat))
Más respuestas (0)
Ver también
Categorías
Más información sobre Programmatic Model Editing 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!