InverseTampere/TreeQSM

define_input.m fails when .mat file contains only one tree

dluks opened this issue · 1 comments

dluks commented

When a .mat file contains only one tree, nt is equal to 1 and so define_input never assigns the cloud to P.

%% Estimate the PatchDiam and BallRad parameters
for i = 1:nt
if nt > 1
% Select point cloud
P = matobj.(names{i});
inputs(i) = Inputs;
inputs(i).name = names{i};
inputs(i).tree = i;
inputs(i).plot = 0;
inputs(i).savetxt = 0;
inputs(i).savemat = 0;
inputs(i).disp = 0;
end

This results in an error on line 89:

%% Estimate the stem diameter close to bottom
% Define height
Hb = min(P(:,3));

I never had this issue, although I always have only one point cloud in my .mat files. Is your point cloud in a matrix with 3 columns (xyz)?