how to solve "Directly accessing field or property of nonscalar struct or object not supported for code generation"?

Viewed 97

My code is as follows:

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

coder command:

codegen -config:lib -args {zeros(3000,3000,'logical')} create_hough_quadprog_b

error message:

Directly accessing field or property of nonscalar struct or object not supported for code generation in this context.

My question is: Should I replace the line with for-loop for access the struct properties one by one?

0 Answers
Related