I have used the following loop to get subplots:
for j=1:19;
    Aj=B(j,:);
    subplot(5,4,j);
    plot(Aj,h)
end
For all these subplots, I need to have only one x-label and one y-label. How to do this? Also how to insert legend to all the subplots?
You can use suplabel from the FileExchange to have combined x and y label for all subplots.
Example:
subplot(1,2,1);
plot(randperm(40)); hold on; plot(randperm(40));  %Plotting some random data
legend('show')   %To show the legend
subplot(1,2,2);
plot(randperm(40)); hold on; plot(randperm(40));  %Plotting some random data
legend('show')   %To show the legend
%Using suplabel from the FileExchange to give a single x and y label for all subplots
suplabel('Combined X label','x');
suplabel('Combined Y label','y');
Output:
Sometimes you have to maximize the figure window to see the xlabel when using suplabel.
来源:https://stackoverflow.com/questions/42695667/how-to-have-a-common-label-for-all-x-and-y-axes-in-case-of-subplots
