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

Satarupa Khamaru
Satarupa Khamaru 2017년 11월 20일
thanks, next time will follow this tutorial to post any code segments. Could you please kindly assist with this issue?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

질문:

2017년 11월 20일

댓글:

2017년 11월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by