Polyline to line segment

6 vues (au cours des 30 derniers jours)
Satarupa Khamaru
Satarupa Khamaru le 20 Nov 2017
Hi, I have a cell array result.mat 1X14 cell array which represent 14 different polyline string.Now I am trying to pick only the longest line segments from each of these 14 polyline string. Below is my piece of code. It worked somewhat but not completely. I would like to save each line segments plotted in the graph in a different 1X14 cell array (similar like my 'result.mat'). Could you please assist?
load result.mat;
for i=1:length(result)
t=result{i};
x=t(:,1);
y=t(:,2);
output = [x y];
d = sqrt(sum(abs(diff(output)).^2,2));
[m,idx]=max(d);
str = int2str(i);
output1 = [output(idx,1) output((idx+1),1)];
output2 = [output(idx,2) output((idx+1),2)];
plot(output1,output2,'-','LineWidth',0.5);
text(output1,output2,str,'Color','red','FontSize',10);
hold on;
end
  2 commentaires
Image Analyst
Image Analyst le 20 Nov 2017
Satarupa Khamaru
Satarupa Khamaru le 20 Nov 2017
thanks, next time will follow this tutorial to post any code segments. Could you please kindly assist with this issue?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by