beginner's question regarding plotting the start and end points of the lines detected

5 ビュー (過去 30 日間)
Abinaya
Abinaya 2014 年 2 月 12 日
回答済み: Iain 2014 年 2 月 12 日
% Plot beginnings and ends of lines
plot(xy(1,1),xy(1,2),'.','LineWidth',2,'Color','yellow');
start(k,1) = xy(1,1);
start(k,2) = xy(1,2);
plot(xy(2,1),xy(2,2),'.','LineWidth',2,'Color','red');
end1(k,1) = xy(2,1);
end1(k,2) = xy(2,2);
start
end1
OUtput:
start= 11 80
54 106
0 0
0 0
132 81
0 0
0 0
110 83
0 0
0 0
117 142
0 0
81 78
115 83
0 0
0 0
0 0
71 72
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
2 66
57 99
0 0
0 0
0 0
0 0
30 131
0 0
216 2
83 135
0 0
0 0
0 0
89 2
183 2
0 0
56 207
100 208
0 0
0 0
0 0
67 115
0 0
0 0
0 0
0 0
0 0
78 70
0 0
0 0
0 0
0 0
0 0
0 0
17 103
21 64
0 0
0 0
0 0
0 0
0 0
0 0
0 0
169 157
0 0
177 82
0 0
150 81
0 0
0 0
0 0
0 0
25 64
59 72
0 0
0 0
0 0
29 199
192 68
0 0
0 0
134 147
27 87
0 0
158 157
0 0
0 0
53 100
0 0
33 77
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
186 13
0 0
0 0
0 0
0 0
100 140
141 150
0 0
0 0
166 192
0 0
200 117
179 169
0 0
0 0
0 0
0 0
0 0
0 0
106 102
0 0
0 0
3 17
0 0
0 0
33 124
145 146
0 0
0 0
0 0
18 16
20 82
22 131
0 0
0 0
0 0
0 0
181 106
We need the output to be displayed without zeros.Kindly give lines of code so that the zero values do not appear.

回答 (2 件)

Walter Roberson
Walter Roberson 2014 年 2 月 12 日
nonzero_start = start(any(start,2),:);

Iain
Iain 2014 年 2 月 12 日
After doing the plot:
a = axis;
a([1 3]) = 1;
axis(a)
All that does is stop the plot the plot showing x & y values lower than 1.

Community Treasure Hunt

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

Start Hunting!

Translated by