How to use a workspace variable to modify a popup mask parameter?

10 次查看(过去 30 天)
I'm using the C2000 blockset for some power conversion applications. I have a simulink model that uses the C2000 ePWM block, and I would like to be able to change some of the popup parameters using the value of a workspace variable to support different hardware configurations. For example, I would like to change the "useModule" parameter using a workspace variable. How can I go about this?

采纳的回答

Ayush
Ayush 2023-9-6
Hi Evelyn,
I understand that you want to change the mask parameters of the C2000 ePWM block using a workspace variable.
It can be by importing the model into MATLAB script and setting the mask parameter by using the set_param function with a pre-defined workspace variable. You can refer to the below documentation to know more about the “set_param” function:
Here is a code snippet for the same:
% load the model in the script
load_system('test');
% defining workspace variable
hardware_config='ePWM8'
% setting the parameter 'useModule' to the defined workspace variable
set_param('test/ePWM','useModule',hardware_config)
% getting the list all the mask parameters
%get_param('test/ePWM','DialogParameters')
Hope it helps,
Regards,
Ayush Misra

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by