Reputation: 3
I have 2 functions, each of which produces a graph. I'm trying to put them both in 1 function, but it only outputs 1 of the 2 graphs (the graph from whichever function is written last). My code looks like this:
function [ output_args ] = Function3( input_args )
Function1;
Function2;
end
Upvotes: 0
Views: 97
Reputation: 213
Hope it works
function [ output_args ] = Function3( input_args )
figure, hold
Function1;
figure(1)
Function2;
end
use hold function in proper place
Upvotes: 0
Reputation: 3640
Function2
is overwriting to the figure. So, the plot of Function1
is lost.
You can just write figure;
between the Function1
and Function2
lines if you want them in seperate windows.
Or if you want them in one window you can use subplot
. Like this:
subplot(2,1,2);
Function1;
subplot(2,2,2);
Function2;
Upvotes: 2