Home > Archive > Matlab > April 2005 > Clearing a plot in a gui
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Clearing a plot in a gui
|
|
| Ronan 2005-04-06, 12:54 pm |
| I have written code for a GUI such that when a button is pressed the
data loaded or recorded is cleared. I want to also be able to remove
the plot of the signal from the GUI. However when I try this by
setting the handle 'visibility' to off only the
background/grid/legend etc. disappears. The plot of the signal itself
stays on the screen.
Also is the following line ok in regard to clearing the save d data?
set(handles.LoadSample,'Userdata',0);
Has anyone any suggestions?
I am using the below code:
if(DataIsLoaded == 1)
ClearData = QUESTDLG('Do you want to clear your previously loaded
file?', 'Clear Data');
switch ClearData
case 'Yes'
set(handles.Filename,'string',' ');
set(handles.FormantFreqs,'string',' ');
set(handles.FundamentalFreq,'string',' ')
set(handles.PhonemeUttered,'string',' ');
set(handles.MfccCB,'Value',0);
set(handles.LpcCB,'Value',0);
set(handles.ClpcCB,'Value',0);
set(handles.axes1, 'Visible', 'off');
DataIsLoaded = 0;
end
elseif(DataIsRecorded == 1)
ClearData = QUESTDLG('Do you want to clear your previously
recorded file?', 'Clear Data');
switch ClearData
case 'Yes'
set(handles.RecordSample,'Userdata',0);
set(handles.Filename,'string',' ');
set(handles.FormantFreqs,'string',' ');
set(handles.FundamentalFreq,'string',' ');
set(handles.PhonemeUttered,'string',' ');
set(handles.MfccCB,'Value',0);
set(handles.LpcCB,'Value',0);
set(handles.ClpcCB,'Value',0);
set(handles.axes1, 'Visible', 'off');
DataIsRecorded = 0;
end
else
warndlg('Nothing to clear yet!', 'No data');
end
| |
| Kelly 2005-04-06, 12:54 pm |
| Ronan wrote:
>
>
> I have written code for a GUI such that when a button is pressed
> the
> data loaded or recorded is cleared. I want to also be able to
> remove
> the plot of the signal from the GUI. However when I try this by
> setting the handle 'visibility' to off only the
> background/grid/legend etc. disappears. The plot of the signal
> itself
> stays on the screen.
>
> Also is the following line ok in regard to clearing the save d
> data?
>
>
> set(handles.LoadSample,'Userdata',0);
>
> Has anyone any suggestions?
>
> I am using the below code:
> if(DataIsLoaded == 1)
> ClearData = QUESTDLG('Do you want to clear your previously
> loaded
> file?', 'Clear Data');
> switch ClearData
> case 'Yes'
>
> set(handles.Filename,'string',' ');
> set(handles.FormantFreqs,'string',' ');
> set(handles.FundamentalFreq,'string',' ')
> set(handles.PhonemeUttered,'string',' ');
> set(handles.MfccCB,'Value',0);
> set(handles.LpcCB,'Value',0);
> set(handles.ClpcCB,'Value',0);
> set(handles.axes1, 'Visible', 'off');
> DataIsLoaded = 0;
> end
> elseif(DataIsRecorded == 1)
> ClearData = QUESTDLG('Do you want to clear your previously
> recorded file?', 'Clear Data');
> switch ClearData
> case 'Yes'
> set(handles.RecordSample,'Userdata',0);
> set(handles.Filename,'string',' ');
> set(handles.FormantFreqs,'string',' ');
> set(handles.FundamentalFreq,'string',' ');
> set(handles.PhonemeUttered,'string',' ');
> set(handles.MfccCB,'Value',0);
> set(handles.LpcCB,'Value',0);
> set(handles.ClpcCB,'Value',0);
> set(handles.axes1, 'Visible', 'off');
> DataIsRecorded = 0;
> end
> else
> warndlg('Nothing to clear yet!', 'No data');
> end
help cla
Just make sure the axis you want is current, and this should remove
all plots while leaving the axis intact
| |
| Ronan 2005-04-06, 12:54 pm |
| Kelly wrote:
> help cla
>
> Just make sure the axis you want is current, and this should remove
> all plots while leaving the axis intact
That works a treat, however, the legend is still visible.
|
|
|
|
|