我需要在点击GUI上的按钮上迭代更新单独的图形窗口。以下是我当前代码的相关部分。它没有在图窗口上绘图。因此创建了一个没有情节的视频。谢谢。
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton14 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.pushbutton14,'string','Creating...','enable','off');
folV = handles.folV;
files1T8 = dir(strcat(folV, '*.mat'));
numFiles1T8 = handles.numFiles1T8;
vAngle = handles.vAngle;
hAngle = handles.hAngle;
s = 1;
pS = 1;
vName = strcat(datestr(now,'yyyymmddHHMMSS'),'.avi');
handles.vName = vName;
guidata(hObject,handles);
writerObj = VideoWriter(strcat(folV,vName));
writerObj.FrameRate = 4;
open(writerObj);
az = 0;
el = 0;
for i = 1:numFiles1T8
load(strcat(folV, files1T8(i).name));
h = figure();
scatter3(pc(1:s:size(pc,1),1), pc(1:s:size(pc,1),2), pc(1:s:size(pc,1),3),pS,pc(1:s:size(pc,1),4:6)/255,'filled');
axis equal;
axis off;
view(az, el);
f = getframe;
fi = frame2im(f);
writeVideo(writerObj,fi);
clear pc;
az = az + hAngle;
el = el + vAngle;
close(h);
end
close(writerObj);
set(handles.pushbutton14,'string','Done','enable','off');
答案 0 :(得分:0)
看看refreshdata
http://ch.mathworks.com/help/matlab/ref/refreshdata.html?refresh=true
然后你可以像
这样的东西axh = plot(xdata, ydata);
//... change the values of xdata and ydata
refreshdata(axh)