Generating code for a single element array
显示 更早的评论
We have a model that interfaces to a legacy variable that is defined as a single element array. The variable's definition comes from a legacy header file, thus we have created our input data object as a Simulink.Signal using the ImportFromFile storage class.
If I set the signal Dimensions to 2 and use a demux or Selector to select the 1st element I get the correct generated code, something like:
temp = mySingleElementArray[0];
However, if I give it a dimension of 1 (which is what it should be) then it is treated as a scalar; even if I put a demux or Selector on the signal. So the generated code is:
temp = mySingleElementArray;
Which loads the address of the array into temp.
How do I define the input signal object so the code treats this variable correctly?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Simulink Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!