Try this:
% Create sample data.
x = 1:4;
numberOfRows = 9;
% A=[1 5 7 8; 4 3 2 3; 5 8 7 1]
A = randi(9, numberOfRows, 4)
[rows, columns] = size(A);
% Figure out array size for subplots.
numberOfPlotsInRow = ceil(sqrt(rows))
% Do the plotting.
for row = 1 : rows
% Figure out which place it needs to go into.
subplot(numberOfPlotsInRow, numberOfPlotsInRow, row);
% Do the plot.
plot(x, A(row, :), 'bs-', 'LineWidth', 2);
% Make it fancy.
grid on;
caption = sprintf('Row #%d', row);
title(caption, 'FontSize', 15);
end