Filter löschen
Filter löschen

change check box by code

3 Ansichten (letzte 30 Tage)
Ehsan
Ehsan am 10 Dez. 2023
Bearbeitet: Mann Baidi am 11 Dez. 2023
Is there any way to change these blocks with code?
I need to change the fault type in my simulation during the simualtion on a line.

Antworten (1)

Mann Baidi
Mann Baidi am 11 Dez. 2023
Bearbeitet: Mann Baidi am 11 Dez. 2023
Hi Ehsan,
I understand that you would like to alter the default settings of the checkbox in the “Three-Phase Fault” Block parameter via code/script.
I would suggest you use “set_param” function in MATLAB for changing the parameter in Simulink. For your specific needs, you can change the parameter as follows:
% Open or create a Simulink model
modelName = 'myModel'; % Replace 'myModel' with your model name
open_system(modelName);
% Get the block path/name
blockName = 'myModel/Three-Phase Fault';
% Set the checkbox on/off
set_param(blockName,'FaultA','off');
get_param(blockName,'FaultA')
save_system(modelName);
For more imformation on “set_param”, you can refer to the following link.
Hope this will resolve your query!
  2 Kommentare
Ehsan
Ehsan am 11 Dez. 2023
Thank you very much for your help, it works greatly !
But one more question, I couldnt uncheck the "Ground", How can I do this?
Mann Baidi
Mann Baidi am 11 Dez. 2023
Bearbeitet: Mann Baidi am 11 Dez. 2023
set the parameter for the "Ground" phase as follows:
set_param(blockName,'GroundFault','off');

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Modeling finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by