Ashok
Ashok

Reputation: 115

Plotting in GUI of Matlab

Until now i had only 1 axis in my GUI to I used to just plot directly using plot command. Plus i need to plot these in a loop.

for i = 1:length(sig)
    plot(sig(i).time,sig(i).signal,sig(i).time,updated(i).filter,)
    hold on
end

Now i have 2 axes in my GUI, how can I make a certain plot appear in 1st axis and another in my 2nd axis

Now for example i need to plot the below in the 2nd axis

 for i = 1:length(sig)
        plot(sig(i).time,sig(i).fil,sig(i).time,updated(i).sig,)
        hold on
    end

Any help will be appriciated

Upvotes: 1

Views: 178

Answers (1)

Erfan
Erfan

Reputation: 1927

You could specify the axes for hold and plot functions. Considering you have two axes, h1 and h2 inside your figure, you could do the following:

hold(h1, 'on')
hold(h2, 'on')
for i = 1:length(sig)
    plot(h1, sig(i).time,sig(i).signal,sig(i).time,updated(i).filter)
    plot(h2, sig(i).time,sig(i).fil,sig(i).time,updated(i).sig)
end

Upvotes: 2

Related Questions