Polyline to line segment

10 Ansichten (letzte 30 Tage)
Satarupa Khamaru
Satarupa Khamaru am 20 Nov. 2017
Kommentiert: Satarupa Khamaru am 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 Kommentare
Satarupa Khamaru
Satarupa Khamaru am 20 Nov. 2017
thanks, next time will follow this tutorial to post any code segments. Could you please kindly assist with this issue?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by