Effacer les filtres
Effacer les filtres

How I change a block mask programmatically using a Level 2 Matlab S function?

1 vue (au cours des 30 derniers jours)
MC
MC le 30 Sep 2020
Réponse apportée : MC le 1 Oct 2020
I would like to change items in a block mask for a Level 2 Matlab S function using the S function.
For example, I have an S function that reads a file and sets the number of outports based on the data in that file. I have a mask on that S function block. How do I configure the port labels of the mask using the S function. Using callbacks in the mask would be acceptable.
I have tried set_param(gcb, 'MaskDisplay', display_code) in the setup function of the S function code but ended up in an unrecoverable recursion situation.
I was going to try to use a callback in the mask itself but have not found a good way to get the data from the S function to the callback.

Réponse acceptée

MC
MC le 1 Oct 2020
I figured it out. I used "Simulink.Mask..." to set the property of the mask in the S function setup which doesn't seem to trigger the S function to run like set_param does.
mask_object = Simulink.Mask.get(gcb);
display_script = mask_object.Display;
Do some stuff to the value of display_script
mask_object.Display = display_script;

Plus de réponses (0)

Catégories

En savoir plus sur Author Block Masks 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