Using OpenFcn to change Simulink mask parameters
Afficher commentaires plus anciens
Hi,
i have a Simulink mask wich I am using to change parameters of a struct. The parameters of the struct can be modified ba the mask or via a matlab-script. If the parameters of the struct are changed by the script, the parameters in the mask won't be changed. I wanted to try using 'OpenFcn' from BlockProperties of my subsystem to set the mask parameters to those values contained in my struct. At first, I tried a very simple code to see, if I can run some code and open the mask in addition to that.
My Code in the OpenFcn:
disp('LoaderWagon') % to check if the callback works
%Path=Mdl.implement.LibraryPath.blk
Path_testframe='Verification_Trailer' % name of the Library (Trailer) in the testframe model (Verification_Trailer/Implement/...)
Path_trailer='Verification_Trailer/Implement/Trailer'
The code above works. The following code cann not be executed:
open_system('Path_testframe')
disp('1of3') % to see in the previous command works
open_system('Path_trailer')
disp('2of3')
set_param(Path_trailer,'h_G',num2str(h_G));
Simulink gives the foloowing error-message: Recursion detected in the OpenFcn of 'Verification_Trailer/Implement/Trailer'.
Is there anyone who knows how to solve this problem?
Greetings
Réponses (1)
Malte Otten
le 4 Mar 2020
1 commentaire
Run
le 9 Fév 2021
Add
open_system(gcbh, 'mask');
at the end of your code.
Catégories
En savoir plus sur Aerospace Blockset dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!