2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > Matlab 生成vhdl matlab - 使用HDL Workflow Advisor将Matlab代码转换为vhdl - 堆栈内存溢出...

Matlab 生成vhdl matlab - 使用HDL Workflow Advisor将Matlab代码转换为vhdl - 堆栈内存溢出...

时间:2020-01-16 03:28:02

相关推荐

Matlab 生成vhdl matlab - 使用HDL Workflow Advisor将Matlab代码转换为vhdl - 堆栈内存溢出...

我制作了一个Matlab程序,它可以检测2个圆是否相交,并输出相交的坐标。 现在,我正在尝试将代码转换为vhdl以进行FPGA实现。

我的代码中在HDL Workflow Advisor中仍然存在错误的功能之一是:

function theta = angle2Points(p1,p2)

%ANGLE2POINTS Compute horizontal angle between 2 points

%

% ALPHA = angle2Points(P1, P2),

% Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a

% [N*1] array. The angle computed is the horizontal angle of the line

% (P1 P2)

% Result is always given in radians, between 0 and 2*pi.

%

% See Also:

% points2d, angles2d, angle3points, normalizeAngle, vectorAngle

%

%

% ---------

dp = zeros(1,2);

% angle of line (P2 P1), between 0 and 2*pi.

dp = p2 - (size(p2, 1) * p1)

theta = mod(atan2(dp(:,2), dp(:,1)) + 2*pi, 2*pi)

错误:

变量“ p1”。 不支持可变大小的数据。

变量“ p2”。 不支持可变大小的数据。

变量“ theta”。 不支持可变大小的数据。

用一个小的测试文件来模拟传入的数据:

% P = [x,y]

P1 = [0,3];

P2 = [5,10];

f=angle2Points(P1,P2);

P1 = [0,3];

P2 = [5,3];

f2=angle2Points(P1,P2

在Workflow Advisor中,我收到:不支持可变大小的数据-第1行出错。

我了解这是因为像C这样的静态类型语言必须能够在编译时确定变量属性,而在Matlab中它是动态发生的。

我想要这个简单功能的一些帮助,以帮助您正确地重写代码以使其准备就绪。

提前致谢

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。