How to Make the Ports and Internal Variables of a FMU Block, Visible or Invisible?
I am using Matlab 2023a to insert an FMU block into my Simulink model with the following two lines of code:
>> addpath(‘path/of/the/fmu/file’)
>> fmu_block = add_block(‘simulink_extras/FMU Import/FMU’, ‘MyModel/MyFMU’, ‘FMUName’, ‘fmu_file.fmu’);
The FMU block is successfully inserted into my model, and everything is currently working well. When I double-click on the FMU block, I can see options to enable or disable the visibility of each output port and internal variable:
Now, I’m wondering how I can use a Matlab script to control the visibility of output ports or variables. I’ve already attempted to retrieve port information using get_param(…), such as this:
port_name = get_param(‘Model/FMU/1’, ‘Name’);
But unfortunately, Matlab gives me this error:
Invalid Simulink object name: ‘Model/FMU/1’.
Caused by:
‘FMU’ is not a SubSystem block.
Therefore, the question remains: How can I retrieve or modify the visibility parameter of the ports and variables within an FMU block? I would appreciate any assistance anyone can provide.I am using Matlab 2023a to insert an FMU block into my Simulink model with the following two lines of code:
>> addpath(‘path/of/the/fmu/file’)
>> fmu_block = add_block(‘simulink_extras/FMU Import/FMU’, ‘MyModel/MyFMU’, ‘FMUName’, ‘fmu_file.fmu’);
The FMU block is successfully inserted into my model, and everything is currently working well. When I double-click on the FMU block, I can see options to enable or disable the visibility of each output port and internal variable:
Now, I’m wondering how I can use a Matlab script to control the visibility of output ports or variables. I’ve already attempted to retrieve port information using get_param(…), such as this:
port_name = get_param(‘Model/FMU/1’, ‘Name’);
But unfortunately, Matlab gives me this error:
Invalid Simulink object name: ‘Model/FMU/1’.
Caused by:
‘FMU’ is not a SubSystem block.
Therefore, the question remains: How can I retrieve or modify the visibility parameter of the ports and variables within an FMU block? I would appreciate any assistance anyone can provide. I am using Matlab 2023a to insert an FMU block into my Simulink model with the following two lines of code:
>> addpath(‘path/of/the/fmu/file’)
>> fmu_block = add_block(‘simulink_extras/FMU Import/FMU’, ‘MyModel/MyFMU’, ‘FMUName’, ‘fmu_file.fmu’);
The FMU block is successfully inserted into my model, and everything is currently working well. When I double-click on the FMU block, I can see options to enable or disable the visibility of each output port and internal variable:
Now, I’m wondering how I can use a Matlab script to control the visibility of output ports or variables. I’ve already attempted to retrieve port information using get_param(…), such as this:
port_name = get_param(‘Model/FMU/1’, ‘Name’);
But unfortunately, Matlab gives me this error:
Invalid Simulink object name: ‘Model/FMU/1’.
Caused by:
‘FMU’ is not a SubSystem block.
Therefore, the question remains: How can I retrieve or modify the visibility parameter of the ports and variables within an FMU block? I would appreciate any assistance anyone can provide. fmu, visibility, set_param MATLAB Answers — New Questions