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

4 commentaires

Muhammad - please clarify what it is that you want. Which signal should be deleted - the one in both axes or just the top or bottom? And what do you mean by actually i want to select the sign? How is that related to deleting any signal shown?
Sorry i didn't elaborate my question correctly .. actually i want to select the rectangle (shown as signal) in upper axes and then i will click the delete button , when i press the button the selected signal deletes, please check the modified version of my gui.
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?
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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by