Reusing Masks' Custom Table data in a Matlab funcion

2 次查看(过去 30 天)
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 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by