使用M块时的错误(在Xilinx系统生成器中)?

时间:2011-12-20 15:20:53

标签: matlab simulink xilinx

我在M Blcok(Simulink中的Xilinx块之一)中编写了这段代码:

function z= discorr(x,y)

t=zeros(12288,1);
i=zeros(12288,1);
k=zeros(12288,1);
i(4096:8191,1)=x(1:4096,2); %output of the image filter
t(4096:8191,1)=y(1:4096,2);   %output of the tamplate filter
i=i';
z=A(1:4096,1);
    for n=1:8191
k=zeros(12288,1);
k(n:n+4095,1)=t(4096:8191,1);
z(n,2)=i*k;

     end
end

它告诉我:

Error("discreatcorr.m"): Syntax error: Lexical error at line 15, column 0. Encountered:  after : "\';\r\nz=A(1:4096,1);\r\nfor n=1:8191\r\n k=zeros(12288,1);\r\n k(n:n+4095,1)=t(4096:8191,1);\r\n z(n,2)=i*k;\r\n end\r\nend\r\n"

Error("discreatcorr.m"): Syntax error: Lexical error at line 15, column 0. Encountered:  after : "\';\r\nz=A(1:4096,1);\r\nfor n=1:8191\r\n k=zeros(12288,1);\r\n k(n:n+4095,1)=t(4096:8191,1);\r\n z(n,2)=i*k;\r\n end\r\nend\r\n"
Error occurred during "Block Configuration".

althogh代码中第15行没有任何内容

在代码末尾发出错误

任何想法?

1 个答案:

答案 0 :(得分:0)

问题是您的系统将'符号误解为字符串符号。用i=i';替换行i=transp(i);可以解决问题。