How to show table data on a mask in simulink?

조회 수: 6 (최근 30일)
Farhan Hussain Qazi
Farhan Hussain Qazi 2020년 4월 14일
댓글: Sai Sri Pathuri 2020년 5월 6일
1- I have a table in matlab which have 2 coloumns. 1st column: Data_module 2nd column: Vorzugswert_e_
2- Now, I have a mask in simulink which is shown below.
Now, as the parameter_name selection changes the mask will show a different value beacuse of the callback function used.
The callback function is shown below:
Callback:
The callback code seems to be self explanatory.
The problem is depending on selection of parameter_name the switch case has differnet codes. The variable "input" takes differnet values based on the selection of parameter name. But the code set_param(gcb,'Parameter3','input'); does not show the value of the vairable 'input'. It shows the name input as it can be seen in the image of the mask. How can I show the value behind that variable and not the name of the variable.

답변 (1개)

Sai Sri Pathuri
Sai Sri Pathuri 2020년 4월 29일
Many block parameter values are specified as character vectors. So, the value that is specified within the quotes will be reflected in the block parameters. If the Vorzugswert_e_ values of the data modules Weight_Housing, Weight_GearCover are constant in your case, you may set Parameter3 as
set_param(gcb,'Parameter3','2.78'); % for Weight_Housing
set_param(gcb,'Parameter3','0.854'); % for Weight_GearCover
  댓글 수: 2
Farhan Hussain Qazi
Farhan Hussain Qazi 2020년 4월 29일
Hello,
The values are not constant. This table is exported from a Doors data module which keeps on changing. Therefore, I have used the code
input=str2double(data2.Vorzugswert_e_(find(strcmp(data2.Data_module, 'Weight_Housing'), 1)));
and than
set_param(gcb,'Parameter3','input');
So, I first store that value in a parameter and than use it.
But you know the problem as I have mentioned it above.
Is there any other way to solve this issue?
Sai Sri Pathuri
Sai Sri Pathuri 2020년 5월 6일
I don't think you may do that. When set_param is used, the value of parameter which is inside the quotes is displayed in the block parameters.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Author Block Masks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by