求matlab的,coder.extrinsic的使用方法。
1个回答
展开全部
The following code declares the MATLAB functions patch and axis extrinsic in the MATLAB subfunction create_plot:
function c = pythagoras(a,b,color) %#codegen
% Calculates the hypotenuse of a right triangle
% and displays the triangle as a patch object.
c = sqrt(a^2 + b^2);
create_plot(a, b, color);
function create_plot(a, b, color)
%Declare patch and axis as extrinsic
coder.extrinsic('patch', 'axis');
x = [0;a;a];
y = [0;0;b];
patch(x, y, color);
axis('equal');
By declaring these functions extrinsic, you instruct the software not to compile or generate code for patch and axis. Instead it dispatches these functions to MATLAB for execution.
function c = pythagoras(a,b,color) %#codegen
% Calculates the hypotenuse of a right triangle
% and displays the triangle as a patch object.
c = sqrt(a^2 + b^2);
create_plot(a, b, color);
function create_plot(a, b, color)
%Declare patch and axis as extrinsic
coder.extrinsic('patch', 'axis');
x = [0;a;a];
y = [0;0;b];
patch(x, y, color);
axis('equal');
By declaring these functions extrinsic, you instruct the software not to compile or generate code for patch and axis. Instead it dispatches these functions to MATLAB for execution.
参考资料: http://www.mathworks.cn/help/toolbox/coder/ref/coder.extrinsic.html
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询