building simulink model from command window

2 visualizaciones (últimos 30 días)
Vanja
Vanja el 7 de Feb. de 2015
Respondida: Jason Moore el 7 de Feb. de 2015
Hello World!
I am trying to build a model via command window.
In this task I have a problem with the next command; add_block('built-in/ToWorkspace', 'untitled/name1', 'Position',[0 0 30 30]), because it changes the default block parameter "Limit data points to last:" from "inf" to 1000. Why is that?
Is there a command to change this parameter to "inf"? I've been looking for a solution but I cannon even find the parameter name, so that I could change it with the "set_param" command..
Thank You!

Respuesta aceptada

Jason Moore
Jason Moore el 7 de Feb. de 2015
To programmatically change the a block parameter you can use get_param and set_param to change parameters of Simulink blocks. The parameter you are looking for is MaxDataPoints. The following commands should get you what you are looking for.
block_handle = add_block('built-in/ToWorkspace', 'untitled/name1', 'Position',[0 0 30 30])
set_param(block_handle,'MaxDataPoints','inf')
Another helpful tip is after you add the block you have an optional output that would be the block handle. I used this handle with set_param to change the desired parameter. You can also pass this handle to the command inspect to see a list of changeable parameters
inspect(block_handle)

Más respuestas (0)

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by