How do I populate a custom table in a Simulink Mask?
조회 수: 5 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2019년 6월 21일
편집: MathWorks Support Team
2024년 8월 29일
I'm looking to add a row in a custom table that’s in a mask. The name of the custom table is 'Table1', and I have the following code in one of the callbacks for a button on the mask:
Table1 = [Table1;cellstr(["a","b","c","d"])]
However, when I click on the button, I receive the following error:
Undefined function or variable Table1
How do I add a row to the custom table?
채택된 답변
MathWorks Support Team
2024년 7월 29일
편집: MathWorks Support Team
2024년 8월 29일
Please note that mask callbacks operate in the Base Workspace. The mask parameters, however, are stored in the mask workspace. This is why you see an error stating 'Undefined function or variable Table1', as the callback does not have access to the mask workspace.
To work around this, you would need to obtain the mask object and access the mask parameters within:
blkName = 'add_row_to_table_callback/Subsystem';
mask = Simulink.Mask.get(blkName);
You would then need to obtain the handle to the custom table in the mask and add the row as follows:
Table1 = mask.getDialogControl('Table1');
Table1.addRow("a","b","c","d");
Please run the below command in the command window of installed MATLAB R2019a version to get release specific documentation
>> web(fullfile(docroot, 'simulink/ug/control-custom-tables-programmatically.html'))
Please follow the below link to search for the required information regarding the current release:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Author Block Masks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!