필터 지우기
필터 지우기

Non-constant expression or empty matrix .This expression must be constant because its value determines the size or class of some expression

조회 수: 3 (최근 30일)
function I am going to convert from .m to .c file using matlab coder while doing it so i am getting error in
this line of below shown code i.e fieldName = char(theFields(match))% case-sensitive field name
code :

답변 (1개)

Walter Roberson
Walter Roberson 2022년 2월 1일
theParam = model.(fieldName);
That struct potentially have a different type for each field, so the type of theParam is not fixed, and so cannot be compiled for.
If you were to initialize theParam to a fixed size and type then possibly you could get further.
  댓글 수: 3
Jeevan Kulal
Jeevan Kulal 2022년 2월 1일
편집: Jeevan Kulal 2022년 2월 2일
function theParam = getParamESC(paramName,temp,model)
theParam = zeros(1,1,"double");
.....further code
i have initialized as shown above, but still getting the same error.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by