How to store data from every cycle in while a loop?
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Point Cloud Processing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!