[英]matlab UpdatePreviewWindowFcn
Im using GUIDE to make a matlab GUI which does some video computation. 我使用GUIDE制作一个matlab GUI,进行一些视频计算。 Using the preview function I can preview the live video from my webcam and do some calculations.
使用预览功能,我可以从我的网络摄像头预览实时视频并进行一些计算。
In the MainGUI i use the: setappdata(hImage,'UpdatePreviewWindowFcn',mypreview_fcn); 在MainGUI中我使用:setappdata(hImage,'UpdatePreviewWindowFcn',mypreview_fcn); to get to a custom preview function which is:
获得自定义预览功能:
function mypreview_fcn(obj,event,himage)
originalframe=peekdata(vidobj,1);
while isempty(originalframe)
originalframe=peekdata(vidobj,1);
end
if kk>=1
[LogResult,y,dist]=QueryArduino;
if LogResult==1
kk=kk+1;
results{kk,1}=originalframe;
results{kk,2}=measure1;
results{kk,3}=measure2;
results{kk,4}=measure3;
results{kk,5}=measure4;
results{kk,6}=measure5;
results{kk,7}=measure7;
offset=median([results{:,7}]);
offset=measure2-measure3;
end
end
set(himage,'CData',originalframe);
end
I would like to pass the result matrix to a table in the MainGUI How can I access the GUI table; 我想将结果矩阵传递给MainGUI中的表如何访问GUI表;
You could do it using getappdata to pass all the data you want inside MainGUI
and populate the table. 你可以通过做getappdata通过所有你想里面的数据
MainGUI
和填充表。 Actually I don't understand why you would use setappdata
to call a function. 其实我不明白你为什么要使用
setappdata
来调用一个函数。
For instance, in the function mypreview_fcn
you coudl write something like this right before the end of the function: 例如,在函数
mypreview_fcn
你可以在函数mypreview_fcn
之前写下这样的东西:
setappdata(0,'MyData',results);
and then in MainGUI
use getappdata
: 然后在
MainGUI
使用getappdata
:
TableData = getappdata(0,'MyData');
set(HandletoTable,'Data',TableData);
An alternative (and better approach I think) to getappdata
would be to assign an output argument to the function mypreview_fcn
so that when you call it from mainGUI
the variable results
is recognized inside mainGUI
and you can populate the table simply using 另一种(和更好的方法,我认为),以
getappdata
将是一个输出参数分配给功能mypreview_fcn
这样,当你从调用它mainGUI
变量results
被里面公认mainGUI
,你可以简单地使用填充表
set(HandletoTable,'Data',results);
Is this what you meant? 这是你的意思吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.