Setting a class object property of type string class in a Coder project
Show older comments
I'm generally please with MATLAB's support for classes in Coder. But I am running into an issue I don't know how to solve.
The target function being compiled has an argument that is a class object. That class object has a property of string class:
tag(1,1) string
That property is being modified in the target function:
myObj.tag = "xyzzy";
The error I get is:
??? Size mismatch (size [1 x 0] ~= size [1 x :?]) in field 'Value'.
Mismatched varying and fixed sizes indicate a probable run-time error. If this diagnostic is incorrect, use indexing to explicitly make the varying size fixed.
I believe this stems from the fact that the tag property is not of type coder.StringType (and thus is "fixed-length") and I can't specify the VariableStringLength and StringLength properties.
The Coder error report isn't much help here -- The tooltip for relevant variables, unfortunately, does not show all the metadata associated with a variable (but I wish it would).
I figured I'd post here before I contact tech support.
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Coder 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!