I have a matrix cell, I want to plot all points into 3 graphs (x,y1), (x,y2) and (x,y3).
y1 y2 y3 x
BCLK103 4.000 5.102 7.055 10
BCLK103 4.100 5.112 7.555 5
BCLK103 4.600 6.182 9.55 3
BCLK105 5.000 5.112 7.255 11
BCLK105 4.060 6.12 8.555 6
BCLK109 4.050 5.112 7.152 10
BCLK109 7.000 5.112 7.545 5
BCLK109 4.900 6.142 8.545 2
BCLK110 3.900 6.311 8.100 2
And I want to plot lines within group in each graph, eg.a line for BCLK103 in the y1 graph connect three points (4.000, 4.100, 4.600), a line for BCLK103 in the y2 graph should connect three points (5.102, 5.112, 6.182), a line for BCLK103 in the y3 graph should connect three points (7.055, 7.555, 9.55); a line for BCLK105 in the y1 graph connect two points (5.000, 4.060) etc. BCLK110 has only one point so it could not form a line in each graph. But I still want its point plotted in each graph.
I tried this:
figure;
f1 = plotmatrix(x,y1);
hold on
for n = 1:9
sameGroup = strcmp(allData(n+1,1), allData(n,1));
if sameGroup
tempx1 = cell2mat(allData(n,5));
tempx2 = cell2mat(allData(n+1,5));
tempy1 = cell2mat(allData(n,2));
tempy2 = cell2mat(allData(n+1,2));
tempx = [tempx2, tempx1];
tempy = [tempy2, tempy1];
plot(tempx, tempy, '-');
end
end
hold off
But MATLAB only plots the scatter graph without any lines. Would anyone please teach me how to plot the points? Am i using hold on correctly?
