Error regarding deletion of an entry from structured array
显示 更早的评论
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 个评论
Image Analyst
2021-1-2
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
2021-1-2
Muhammad Bilal Khawar
2021-1-2
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Binomial Distribution 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!