Plotting into Multiple Axes in GUI

1 次查看(过去 30 天)
I am writing a signal generater where a number of different user controlled signals are varied and then fourier transformed.
I am unable to determine which axes the signals are plotted into. They default into the first axes. I have tried using 'axes(handles.SignalAxes)' but it returns an error message.
See the photo of my basic gui and an extract from the code. I need the 'fourier transform' part of the code to plot into the second of the four axes.
Thanks in advance
function Frequency_Callback(hObject, eventdata, handles)
% hObject handle to Frequency (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
f = get(hObject,'Value');
assignin('base','f',f);
setappdata(0,'f',f);
updateAll()
%there is an identical function for each of the four sliers
function updateAll
f=round(getappdata(0,'f'));
S_rate=round(getappdata(0,'S_rate'));
t=round(getappdata(0,'t'));
phi=round(getappdata(0,'phi'));
Sin_Wave(f,phi,S_rate,t)
%Fourier transform
signal = Sin_Wave(f,phi,S_rate,t);
t=linspace(0,t,S_rate);
n=length(t);
fft1 = fft(signal,n);
PSD = (fft1.*conj(fft1))./n;
freq = 1/(n.*0.0101)*(0:n);
L = 1:floor(n/2);
%axes(handles.SignalAxes) %this function results in an error message
loglog(freq(L),PSD(L)) %this should plot into the second figure in the GUI, but it does not

采纳的回答

J. Alex Lee
J. Alex Lee 2020-10-16
Any plot command can accept as a first argument a target axes object to plot into.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Objects 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by