フィルターのクリア

Error: K must be numeric, scalar, real, integer-valued, and greater than or equal to zero in bitsra(A,K)

2 ビュー (過去 30 日間)
Tamer
Tamer 2015 年 8 月 14 日
コメント済み: Tamer 2015 年 8 月 14 日
Hello There,
I'm working at a very long program, and I'm trying to converting (.m) code to VHDL code, but I got the following error.
The Matlab created the following function to divide the (fi) values.
Can you please help me to fix this error ?
Error:
??? K must be numeric, scalar, real, integer-valued, and greater than or equal to zero in bitsra(A,K).
Genrated Code from Matlab:
function y = fi_div_by_shift(a,shift_len)
coder.inline( 'always' );
if isfi( a )
nt = numerictype( a );
fm = fimath( a );
nt_bs = numerictype( nt.Signed, nt.WordLength + shift_len, nt.FractionLength + shift_len );
y = bitsra( fi( a, nt_bs, fm ), shift_len );
else
y = a/2^shift_len;
end
end

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 14 日
At the command line command
dbstop if error
and run the code. When it stops with the error, if necessary command
dbup
one or more times until you are examining this file. Request
class(shift_len), shift_len
and show us the results. Then use dbup once more and show us the line of code that is calling the routine.
  1 件のコメント
Tamer
Tamer 2015 年 8 月 14 日
the error at this line, although I wrote the code as below
original Code:
for op=1:1:le
b2(op)=in_2(op).*2;
end
Note: in_2(op) is fi 1x1000000
b2(op) is fi 1x1000000
matlab generated code:
for op=1:1:le
b2(op)=fi_div_by_shift(in_2(op), -1);
end

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

Community Treasure Hunt

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

Start Hunting!

Translated by