MATLAB: How to plot 2 matrix with different n of row and column (both are 9 x 6)

matrix plotting

I have both matrix…just wanna do a scatter plot with them…plot (SO, PO, 'o') but the last 3 rows does not appear in the graph.
S0 = [0.50 0.40 1.10 0.20 0.50 3.40;...
0.30 0.30 0.50 0.80 1.20 9.20;...
0.20 0.10 0.20 1.10 2.40 2.50;...
0.20 0.00 0.60 2.70 7.20 16.00;...
0.10 1.10 1.90 1.10 1.50 0.40;...
1.30 1.40 2.70 3.80 7.10 6.30;...
3.00 2.70 2.60 2.80 1.80 1.80;...
1.8 1.4 0.70 0.30 0.90 0.7;...
0.70 15.10 14.70 6.10 3.10 2.20];
PO = [104.3 79.4 20.5 18.6 76.2 284.9;...
56.1 71.5 31.5 28.3 26.2 217.9;...
253.5 151.8 41.3 35.8 47.3 39.5;...
27.9 25.3 20.6 18.7 60.5 259.2;...
19.0 39.0 206. 198.7 123.7 50.3;...
41.4 156.3 171.2 206.4 84.0 38.8;...
92.2 30.7 66.4 37.1 38.4 100.9;...
10.4 17.0 50.1 36.6 43.8 38.9;...
4.1 270.2 156.1 17.7 10.1 19.8];

Best Answer

Try this:
fontSize = 15;
SO = [0.30 0.30 0.50 0.80 1.20 9.20;...
0.20 0.10 0.20 1.10 2.40 2.50;...
0.20 0.00 0.60 2.70 7.20 16.00;...
0.10 1.10 1.90 1.10 1.50 0.40;...
1.30 1.40 2.70 3.80 7.10 6.30;...
3.00 2.70 2.60 2.80 1.80 1.80;...
1.8 1.4 0.70 0.30 0.90 0.7;...
0.70 15.10 14.70 6.10 3.10 2.20];
PO = [104.3 79.4 20.5 18.6 76.2 284.9;...
56.1 71.5 31.5 28.3 26.2 217.9;...
253.5 151.8 41.3 35.8 47.3 39.5;...
27.9 25.3 20.6 18.7 60.5 259.2;...
19.0 39.0 206. 198.7 123.7 50.3;...
41.4 156.3 171.2 206.4 84.0 38.8;...
92.2 30.7 66.4 37.1 38.4 100.9;...
10.4 17.0 50.1 36.6 43.8 38.9;...
4.1 270.2 156.1 17.7 10.1 19.8];
sz = min(size(SO), size(PO))
% Get colors for each row
cmap = jet(sz(1));
for row = 1 : sz(1) % For as many rows as the one with the fewest rows has...
% Get the data from this row only.
thisSO = SO(row, :);
thisPO = PO(row, :);
% Get a unique color for the spots of this row.
thisColor = cmap(row, :);
% Make a scatterplot of the points in this row only.
scatter(thisSO, thisPO, 50, thisColor, 'filled');
hold on;
legendStrings{row} = sprintf('Row %d', row);
end
xlabel('SO', 'FontSize', fontSize);
ylabel('PO', 'FontSize', fontSize);
grid on;
legend(legendStrings);