필터 지우기
필터 지우기

force scalar signal to be a 1D array

조회 수: 4 (최근 30일)
Aditya Kumar
Aditya Kumar 2017년 5월 18일
답변: Suhan 2017년 5월 24일
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

답변 (1개)

Suhan
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.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by