필터 지우기
필터 지우기

C++ code generation fail

조회 수: 3 (최근 30일)
Andrew Grusha
Andrew Grusha 2011년 7월 8일
댓글: PIYUSH SWAMI 2021년 9월 13일
I need to translate my program written in Matlab to C++. When I use MATLAB Coder, it offers me to define all variables which are input parameters for the function, but all local variables it defines itself, and by default it makes most of them non-complex. During translating, I've got message: "Cannot assign a complex value into a non-complex location." How can I directly declare local variables as complex?

답변 (1개)

John Elliott
John Elliott 2011년 7월 8일
Instead of, say,
z = 42;
use
z = complex(42);
  댓글 수: 1
PIYUSH SWAMI
PIYUSH SWAMI 2021년 9월 13일
Codegen is giving the same error for this line:
state.icaweights = V / sqrt(D) * V' * state.icaweights;
When I tried the codegen again by writing:
state.icaweights = complex(V / sqrt(D) * V' * state.icaweights);
OR
state.icaweights = double(V / sqrt(D) * V' * state.icaweights);
it still provided the same error. Can anyone please help in rectification of this error?

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

카테고리

Help CenterFile Exchange에서 Build Configuration에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by