フィルターのクリア

Embedded matlab function error..

4 ビュー (過去 30 日間)
Sriharsha
Sriharsha 2012 年 2 月 8 日
How to resolve this type of errors?/
---------------------------------
Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?].
-------------------------------------

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 2 月 8 日
It looks like you are trying to create a variable whose size is dynamic. For example:
function y = myfun(n)
y = zeros(1,n);
Since Embedded MATLAB uses static memory allocation, it cannot handle variables that change size dynamically. What you can do is declare 'y' as variable-sized while specifying an upper bound for the size.
function y = myfun(n)
coder.varsize('y', [1 1024]); %n must never exceed 1024
y = zeros(1,n);
  2 件のコメント
Sriharsha
Sriharsha 2012 年 2 月 9 日
Hi mam,
i wil let you know my function.
i am using this function inside an embedded matlab function block..
--------------------------------------------
function [tiq,Isymbols,Qsymbols,sumiq]= qpsk(N)
%#eml
fcarr=2e3;
%N=10;
fs=16*1e3;
Fn=fs/2;
Ts=1/fs;
T=1/N;
randn('state',0);
td=[0:Ts:(N*T)-Ts]';
data=sign(randn(N,1))';
data1=ones(T/Ts,1)*data;
data2=data1(:);
tiq = [0:Ts*2:(N*T)-Ts]';symbols(transpose)
bs1=data(1:2:length(data));
symbols=ones(T/Ts,1)*bs1;
Isymbols=symbols(:);
bs2=data(2:2:length(data));
symbols1=ones(T/Ts,1)*bs2;
Qsymbols=symbols1(:);
twopi_fc_t=(1:fs/2)*2*pi*fcarr/fs;
a=1;
phi=0;
cs_t = (a * cos(twopi_fc_t + phi));
sn_t = (a * sin(twopi_fc_t + phi));
cs_t=cs_t';
sn_t=sn_t';
si=cs_t.*Isymbols;
sq=sn_t.*Qsymbols;
sumiq=si+sq;
sumiq=.7*sumiq;
-------------------------------------------------
And then , i am facing such errors....
------------------------------
Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]
--------------------------------------
Kaustubha Govind
Kaustubha Govind 2012 年 2 月 9 日
Does it point to a specific line? I can see several lines where you are creating variables of dynamic size:
data=sign(randn(N,1))';
data1=ones(T/Ts,1)*data;
tiq = [0:Ts*2:(N*T)-Ts]';
bs1=data(1:2:length(data));
symbols=ones(T/Ts,1)*bs1;
bs2=data(2:2:length(data));
symbols1=ones(T/Ts,1)*bs2;

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by