Error regarding deletion of an entry from structured array
Show older comments
Hi,
I am performing polygon analysis from some pictures. I have the vertices and the respective distances among these vertices for all polygons. Now i want to filter out the vertices that are close to each other accrding to a threshold value and remove these vertices. So far i have been able to remove the entries from the distances matrix but the vertices at the same index are not getting removed. I get the error
''Index in position 1 is invalid. Array indices must be positive integers or logical values.
coords(g,:) = []; ''
Here is my code so far:
for i=1:nFloes
diss = vertcat(Dist_Ver{i});
for g =(length(diss)):-1:1
if (diss(g) < 5)
diss(g) = []; %%this thing works fine
g=g-1;
coords(g,:) = []; %% But the entries in here are not getting deleted even if the index is the same
end
end
% New_Dist_Ver{i} = diss;
end
If i run the same code for a single polygon, it works fine but isn't working if i apply it for all the polygons. Any help will be highly appreciated. Thanks.
3 Comments
Image Analyst
on 2 Jan 2021
Make it easy for us to help you.
Can you attach nFloes and Dist_Ver in a .mat file
save('answers.mat', 'nFloes', 'Dist_Ver');
then use the paper clip icon.
Muhammad Bilal Khawar
on 2 Jan 2021
Muhammad Bilal Khawar
on 2 Jan 2021
Accepted Answer
More Answers (0)
Categories
Find more on Binomial Distribution 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!