passing a cell array structure to matlab function

41 views (last 30 days)
I am using matlab function block in Simulink. I have to pass a structure as input to the function. I have changed the type to parameter in model explorer. While executing i received the error " Error using sf MATLAB class 'cell' found at 'ctx.S' is unsupported."
I tried converting the cell array to character array and then used the character array(instead of entire structure) as input to the function. In this case i got error " Error using sf Expression 's' for initial value of data 's' (#51) must evaluate to a numeric or logical"
ctx is the structure i am using.
i assigned the structure fields as s =ctx.S
ctx.S is a cell array of hexadecimal values stored as strings.
I want to have the data as hexadecimal inside the function.How do i pass the values in ctx.S to the matlab function used in Simulink?
Thanking you in advance.

Answers (1)

Walter Roberson
Walter Roberson on 9 Dec 2013
Simulink does not support cell arrays or strings as data types for signals. Anything you want to pass to another block as a signal must be in numeric form (or logical).


Community Treasure Hunt

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

Start Hunting!