Two image handles using setappdata in a Matlab GUIDE GUI

So I created a GUI with one axis, three push buttons and 6 static text fields. Im referring to this example: https://de.mathworks.com/help/imaq/previewing-data.html?s_tid=gn_loc_drop.
My problem is that Im using two gige cameras which means that I need two image handles "hImages" 1 and 2.
This is what I think that I have to use:
vidRes = handles.vid1.VideoResolution;
imWidth = vidRes(1);
imHeight = vidRes(2);
nBands = handles.vid1.NumberOfBands;
hImage1 = image(zeros(imHeight,imWidth,nBands));
vidRes = handles.vid2.VideoResolution;
imWidth = vidRes(1);
imHeight = vidRes(2);
nBands = handles.vid2.NumberOfBands;
hImage2 = image(zeros(imHeight,imWidth,nBands));
setappdata([hImage1, hImage2],'UpdatePreviewWindowFcn',@mypreview_fcn);
setappdata(hImage1,'HandleToTimestampLabel',handles.text1);
setappdata(hImage1,'HandleToResolutionLabel',handles.text2);
setappdata(hImage1,'HandleToStatusLabel',handles.text3);
setappdata(hImage2,'TimestampLabel',handles.text9);
setappdata(hImage2,'ResolutionLabel',handles.text8);
setappdata(hImage2,'StatusLabel',handles.text7);
Is this possible or is there even a better way to do so?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by