本文介绍了回调函数不更新句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据此代码使用回调函数

I am using a callback function according to this code callback function in gui does not know handles

但是在使用回调函数调用的函数中,我不能更改句柄结构中的数据。

However in the function that is called with the callback function I can not change data in the handle structure.

handles.waitbar.text = 'Reading images ...';
handles = readStackAndCreateFokusFunktion( ...
              handles , ...
              @(value, maxValue) ...
                    z_WaitBarUpdate(value, maxValue, handles));

在我修改句柄的函数中,但是在函数 z_WaitBarUpdate

In the function called I modify the handle, but this is not used in the function z_WaitBarUpdate.

function handles = readStackAndCreateFokusFunktion( handles, fcallback )

handles.waitbar.text = 'Extracting number of images in calibration file ...'; 
guidata(handles.output,handles);
% calls z_WaitBarUpdate as extpected, but the text is still 'Reading images ...'
fcallback(0, 100);


推荐答案

您必须在最后更新句柄结构

you must update handles structure at the last

guidata(handles.output);

这篇关于回调函数不更新句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 22:19