Reusing Masks' Custom Table data in a Matlab funcion

조회 수: 5 (최근 30일)
Benoit Beaulieu
Benoit Beaulieu 2022년 12월 24일
답변: Dhruv 2023년 9월 3일
Hi everyone
I feel like a dumbass, but I just can't find the anwser.
I have a masked model, in which a list (customtable), of an unknown size, containing numerical and text data. I wish to send the data (Cell array) to a matlab function block, but I fail.
I can't get GCD to work from witin the fuction, thus can't get hold of an Handle. (Dynamic path of the block is not accessible)
FromWorkspace block still only allowing matrices (predefined sizes of same type data).
What do you use to handle Cells arrays in to be reuseable Simulink blocs?

채택된 답변

Dhruv
Dhruv 2023년 9월 3일
It seems that you're trying to pass a cell array containing custom table data from a masked model to a MATLAB Function block in Simulink. Unfortunately, passing cell arrays directly to MATLAB Function blocks in Simulink is not straightforward due to the restrictions on supported data types.
Since MATLAB Function blocks in Simulink support structures as input, you can convert your cell array to a structure array where each cell element becomes a field in the structure. This can be done outside the MATLAB Function block.
You may want to refer to the following link to get to know more about it:
Remember that MATLAB Function blocks work best with basic data types like double, single, int, etc. Complex structures like cell arrays require conversion to compatible types.
Additionally, if the size of the cell array is unknown, you might need to dynamically resize the structure array within your MATLAB Function block or implement dynamic allocation strategies.

추가 답변 (0개)

카테고리

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