Ben
Ben

Reputation: 1849

Add data to specific subplot

Suppose I have 2 figures and in each one I have 3x3 subplot matrix.

The code looks like:

figure(1)
subplot(3,3,1)
plot(...)
subplot(3,3,2)
plot(...)
subplot(3,3,3)
plot(...)
subplot(3,3,4)
plot(...)
and so on

Some Calculations

figure(2)
subplot(3,3,1)
plot(...)
subplot(3,3,2)
plot(...)
subplot(3,3,3)
plot(...)
subplot(3,3,4)
plot(...)
and so on

and here I have more calculations.

Now, I had like to insert inside subplot(3,3,4) in figure(2) the (x,y) I had just calculated in the end.

I guess a solution would be to plot the graphs after all of the calculations but in case I dont want to change the order, how can I do it?

Thank you.

Upvotes: 0

Views: 754

Answers (1)

Savithru
Savithru

Reputation: 745

You can call the subplot command in any order. At any point in the code, if you want to only plot something on the m-th block of figure(n), just do:

figure(n);
subplot(3,3,m);
plot(...)

All existing plots in other blocks will remain unchanged.

Upvotes: 1

Related Questions