How can I create an output bus with variable-size elements using a structure in Embedded MATLAB?
Show older comments
I would like to setup the Embedded MATLAB Function block to output a bus with variable dimensions. When I attempt to use 'eml.varsize' to define a specific signal within the bus to be variable-size, as shown in the attached model (incorrect.mdl), I receive the following errors:
struct {ab_diff: double, ab_sum: double} ~= struct {ab: double, ab_sum: double}. Structures don't match.
The struct to the left is the class of the left-hand side of the assignment.
Function 'Embedded MATLAB Function' (#47.146.152), line 12, column 1:
"outbus"
Launch diagnostic report.
Size of outbus(:).ab_diff can not be modified as the variable outbus is already locked. Place the eml.varsize() declaration before the first use of outbus.
Function 'Embedded MATLAB Function' (#47.195.214), line 13, column 13:
"'outbus(:).ab_diff'"
Launch diagnostic report.
Size mismatch (size [1 x 1] ~= size [1 x 3]).
The size to the left is the size of the left-hand side of the assignment.
Function 'Embedded MATLAB Function' (#47.223.237), line 14, column 1:
"outbus.ab_diff"
Launch diagnostic report.
Accepted Answer
More Answers (0)
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!