Why axes handles disappeared after call of slider callback function?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Adam
el 24 de Mzo. de 2017
Please show all relevant code otherwise we are just guessing what you might have done without seeing the callback in question.
Respuestas (1)
Jan
el 24 de Mzo. de 2017
See https://www.mathworks.com/matlabcentral/answers/57550-faq-incomplete-handles-struct-in-callbacks:
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.
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!