How can I solve this error with MATLAB CODER?

1 回表示 (過去 30 日間)
Yulia M
Yulia M 2019 年 12 月 16 日
コメント済み: Ridwan Alam 2019 年 12 月 17 日
Hi,
I am New to MATLAB. I am trying to convert the following MATLAB code to C code using MATLAB coder but I am getting the following error in the scrren shot.
Can someone please help me with this?
Regards,
Y
function [Conv_out] = conv_enc_test(Conv_In)
Conv_In = [1,0,1,0,1];
Conv_out = [];
m1=0;
m2=0;
m3=0;
m4=0;
for k = 1:length(Conv_In)
%%1st polynomial
m_in = Conv_In(k);
%first polynomial
temp1 = bitxor(m_in,m2);
x0 = bitxor(temp1,m4);
%2nd polynomial
temp1 = bitxor(m_in,m1);
temp2 = bitxor(temp1,m3);
x1 = bitxor(temp2,m4);
Conv_out((2*k)-1) = x0;
Conv_out(2*k) = x1;
%%%Shifiting
m4=m3;
m3=m2;
m2=m1;
m1=m_in;
end

採用された回答

Ridwan Alam
Ridwan Alam 2019 年 12 月 17 日
In your example you can certainly preallocate the variable:
Conv_out = zeros(1,2*length (Conv_In));
  2 件のコメント
Yulia M
Yulia M 2019 年 12 月 17 日
Hi Ridwan,
thank you. It worked.
regards,
Ridwan Alam
Ridwan Alam 2019 年 12 月 17 日
Great. Glad to help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Coder についてさらに検索

タグ

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by