User`s guide
Previewing Data
ht = getappdata(himage ,'HandleToTimestamp Label');
% Set the value of the text label .
set(ht,'String',tstampstr);
% Display image data.
set(himage, 'CData ', event.Data)
Specifying the Update Preview Function
To use an update preview window function, store a function handle to your
function in the
'UpdatePreviewWindowFcn' application-defined data of
the im age object. The following exa mple uses th e
setappdata function to
configure this application-defined data to a function handle to the update
preview window function described i n “Creating the Update Preview Window
Function” on page 2-13.
This example ex tends the simple custom prev iew window cre ated in
“Previewing Data in Custom G UIs” on page 2-11. This example adds three
push button
uicontrol objects to the GUI: Start Preview, Stop Preview,
and Close Preview.
In addition, to illustrate using an update preview window function, the
example GUI includes a text label
uicontrol object to display the timestamp
value. The update preview window function updates this text label each
time a framed is received. The example uses
setappdata to store a handle
to the text label
uicontrol object in application-defined data in the image
object. The update preview window function retrieves this handle to update
the timestamp display.
% Create a video input object .
vid = videoinput('winv ideo');
% Create a figure window. Thi s ex ampl e tu rns off the default
% toolbar and menubar in the figure.
hFig = figure('Toolbar ','none',...
'Menubar', 'none', ...
'NumberTitle','Off',...
'Name','My Custom Prev iew GUI');
2-15