I have a file a.txt which is like:
0 0 0 3 4 3
0 0 3 0 3 4
0 1 0 4 4 4
0 1 3 1 3 5
0 2 0 5 4 5
0 3 0 0 4 0
These are vertices of triangles [x1 y1 x2 y2 x3 y3] that I need to plot on a 6x6 grid. I need to see these triangles on a single graph.
How can this be done in MATLAB?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ thanks a lot everyone!
finally what worked:
a = dlmread('a.txt');
clf
xlim([0 6])
ylim([0 6])
for i = 1:size(a,1)
line(a(i,[1:2:5,1]), a(i,[2:2:6,2]), 'color',rand(1,3))
pause;
end
grid on;