Setting a class object property of type string class in a Coder project
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!