代码如下:
function [allLinePoint] = create_hough_quadprog_b(BW) %#codegen
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
[H,theta,rho] = hough(BW,RhoResolution=5);
P = houghpeaks(H,30,'Threshold', 0.1*max(H(:)) );
lines = houghlines(BW,theta,rho,P,'FillGap',60,'MinLength',5 );
pointX = vertcat(lines.point1); %% <---- error here
pointX = vertcat(lines.point1);
pointY = vertcat(lines.point2);
allLinePoint = cat(1,pointX,pointY);
end
编码器命令:
codegen -config:lib -args {zeros(3000,3000,'logical')} create_hough_quadprog_b
错误信息:
Directly accessing field or property of nonscalar struct or object not supported for code generation in this context.
我的问题是:我应该用for-loop替换这一行来逐个访问结构体属性吗?
1条答案
按热度按时间8mmmxcuj1#
我的问题是:我应该用for-loop替换这一行来逐个访问结构体属性吗?
是的,你应该这样做,截至目前,最新版本的MATLAB R2023 a仍然不支持上述语法/功能,可以直接使用for循环逐个赋值,例如,支持以下代码片段。