force scalar signal to be a 1D array
8 ビュー (過去 30 日間)
古いコメントを表示
I have a use-case, where I need to force a scalar input signal, say u1 to a subystem test1 in a Simulink model, to be treated as a 1D array with 1 element. In particular, when I generate C-code from test1, instead of the input being declared as "static real_T test1_U_u1;", I need it to be declared as "static real_T test1_U_u1[1];". Is there a way to do this either in Simulink and/or via some settings for code generation? Please let me know at the earliest. I am using R2015b with Simulink, Matlab and embedded coders. Thanks. -Aditya
0 件のコメント
回答 (1 件)
Suhan
2017 年 5 月 24 日
Currently, this is not possible in Simulink. However, one alternative to consider depending on the use case is to use a custom storage class for the variable and set it to "ImportedExternPointer". A example of this can be found in the documentation here: http://www.mathworks.com/help/ecoder/ug/pointers-for-signals.html?s_tid=srchtitle
Another alternative which is much simpler is to specify Variable-size within a subsystem Inport. Select support for variable-sized signal in the signal attributes and make sure to enter a maximum dimension for the vector and uncheck the interpolate data option. This will generate variable sized assignments.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!