How can i delete any signal shown in figure by using Push button in a GUI? Actually i want to select the sign

1 view (last 30 days)
  4 Comments
Joseph Cheng
Joseph Cheng on 26 Feb 2015
there are some ways to do this. One question is how are these bars being plotted? are they individual plots as if we performed a hold on (such that each one can be found as the axes children), or are they concatenated into a single plot/barchart?
Muhammad Saim Nasir Siddiqui
Edited: Muhammad Saim Nasir Siddiqui on 28 Feb 2015
yes these are individually ploted.. first i give bandwidth,select band and give a center freq and then press generate pushbutton (to plot a rectangle as shown in fig.) here is the code for " Generate" push button call back
function Generate_Callback(hObject, eventdata, handles) % hObject handle to Generate (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
bw=str2num(get(handles.bw,'String')); %f0=str2num(get(handles.f0,'String')); l=str2num(get(handles.frequency,'String')); m=get(handles.frequency,'value'); f0=l(m);
y=0; z=0; %x=0;0 for k=1:50
if handles.f00(k)==f0
%msgbox('Center Frequency Already Occupied')
z=1;
end
end
switch z
case 0
handles.count=handles.count+1;
i=handles.count;
handles.bww(i)=bw;
handles.f00(i)=f0;
bw=bw*1e9;
f0=f0*1e12;
q=f0/bw;
f1=f0*(sqrt(1+1/(4*q^2))-1/(2*q));
w2=3e8/f1;
f2=f0*(sqrt(1+1/(4*q^2))+1/(2*q));
w1=3e8/f2;
handles.w11(i)=w1;
handles.w22(i)=w2;
width=w2-w1;
handles.width(i)=width;
%axes(handles.axes1);
%rectangle('position',[w1,0,width,4],'FaceColor','g');
if handles.s==1
axes(handles.axes1);
rectangle('position',[w1,0,width,4],'FaceColor','g');
axis([1460e-9,1530e-9,0,7]);
elseif handles.c==1
axes(handles.axes1);
rectangle('position',[w1,0,width,4],'FaceColor','g');
axis([1530e-9,1565e-9,0,7]);
elseif handles.l==1
axes(handles.axes1);
rectangle('position',[w1,0,width,4],'FaceColor','g');
axis([1565e-9,1625e-9,0,7]);
end
xlabel('wavelength');
ylabel('power');
guidata(hObject, handles);
case 1
msgbox('Center Frequency Already Occupied')
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!