Azzera filtri
Azzera filtri

building simulink model from command window

2 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Jason Moore
Jason Moore il 7 Feb 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)

Più risposte (0)

Categorie

Scopri di più su Programmatic Model Editing in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by