How to store data from every cycle in while a loop?
Show older comments
Hello,
i'm trying to extract point data from slices taken from a point cloud. ptCloudSegmented contains the x,y,z of every point of the slice.
I wrote this code:
ptCloud=pcread('1_no_OK.ply'); %this is the whole point cloud
zLim=[0,0.5]; %section interval
while zLim < ptCloud.ZLimits (2)
zIdx = ptCloud.Location(:,3)>=zLim(1) & ptCloud.Location(:,3)<=zLim(2);
ptCloudSegmented = ptCloud.Location(zIdx,:);
ptCloudSegmented = double(ptCloudSegmented); % this is what i'm trying to save into a matrix in every cycle
zLim=zLim+0.5;
end
The problem is that every time the cycle restarts the ptCloudSegmented is overwritten by the new section of points. So i'm trying to insert a structure containing more instances of ptCloudSegmented, added dynamically, but i red that using dynamic variables makes the code a bit unstable. There's a way to solve this issue? Thanks in advice
Accepted Answer
More Answers (0)
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!