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

1 次查看(过去 30 天)
  4 个评论
Joseph Cheng
Joseph Cheng 2015-2-26
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
编辑:Muhammad Saim Nasir Siddiqui 2015-2-28
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

请先登录,再进行评论。

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by