How to write the coordinats from the dpsimplify function into a new data
8 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone I've got boundaries of an object. Now i'd like to simplify them with the dpsimlify(p,tol) funkction. This works great so far, i can plot it and it looks good. However when I want to write the coordinats of the simplified data into a datastring it doesn't work how I want it to work. I've got this so far:
for i = 1: length(B)
p = B{i};
tol = 3;
[ps,ix] = dpsimplify(p,tol);
plot(p(:,2),p(:,1),'k')
hold on
plot(ps(:,2),ps(:,1),'r','LineWidth',2);
legend('original polyline','simplified')
boundary(i).id = i;
boundary(i).X = ps(:,2);
boundary(i).Y = ps(:,1);
end;
When i do it like this, I get 2024 elements in the boundary data. but the length of B is just 68. Some of the elements of B are doubled in the boundary data . I hope you understand my problem and know how to fix it.
Cheers Sams
0 件のコメント
回答 (1 件)
Image Analyst
2014 年 5 月 19 日
I don't know what that function is. Perhaps you can use unique() to extract out only the unique rows.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!