Effacer les filtres
Effacer les filtres

building simulink model from command window

2 vues (au cours des 30 derniers jours)
Vanja
Vanja le 7 Fév 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!

Réponse acceptée

Jason Moore
Jason Moore le 7 Fév 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)

Plus de réponses (0)

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by