Borrar filtros
Borrar filtros

Reusing Masks' Custom Table data in a Matlab funcion

2 visualizaciones (últimos 30 días)
Benoit Beaulieu
Benoit Beaulieu el 24 de Dic. de 2022
Respondida: Dhruv el 3 de Sept. de 2023
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?

Respuesta aceptada

Dhruv
Dhruv el 3 de Sept. de 2023
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.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by