Why axes handles disappeared after call of slider callback function?

1 visualizzazione (ultimi 30 giorni)
I used simple callback function for slider and when tried to set value to axes handles.axpulse, I got that there is no such a field. I checked this and found that before I call slider callback (in my case - fftmin(hObject,event_data,handles)) I have complete list of handles:
handles_1 =
figure1: [1x1 Figure]
text3: [1x1 UIControl]
HIT: [1x1 UIControl]
download: [1x1 UIControl]
output: [1x1 Figure]
Signal: [62504x3 double]
ftt: [1x1 Figure]
fftmin: [1x1 UIControl]
fftmax: [1x1 UIControl]
axpulse: [1x1 Axes]
axsig: [1x1 Axes]
However, after the call, the list changed and handles to axes fields disappeared:
figure1: [1x1 Figure]
text3: [1x1 UIControl]
HIT: [1x1 UIControl]
download: [1x1 UIControl]
output: [1x1 Figure]
Signal: [62504x3 double]
ftt: [1x1 Figure]
fftmin: [1x1 UIControl]
Why? And how to fight this?
  1 Commento
Adam
Adam il 24 Mar 2017
Please show all relevant code otherwise we are just guessing what you might have done without seeing the callback in question.

Accedi per commentare.

Risposte (1)

Jan
Jan il 24 Mar 2017
I guess your slider callback does something like this:
function sliderCallback(hObject, EventData, handles)
...
handles.xyz = get(hObject, 'Value');
guidata(hObject, handles);
end
The the handles struct from the inputs is used, but this is not the current value, but is the the state of the handles struct during the creation of the callback. To get the current value, obtain it from the figure:
function sliderCallback(hObject, EventData, handles_FromInputs)
handles = guidata(hObject); % <-- Get current value
...
The handles struct causes problems such frequently, that I consider it as design error.

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by