How do I assign one plot3-animation to multiple axes on Matlab 2013 GUI?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello dear Matlab Community,
I'm currently working on a Matlab 2013 GUI. The GUI has multiple Axes (2 in that example) and I want to show a 3d Animation on all axes. The axes only differ in their size and view property. I animate using plot3 since scatter3 is incredibly slow on matlab 2013 (about 40sec for one scatter in the animation). Therefor I use a for loop to plot points with different colors (132 in total for every step of the animation). KnM is my data matrix with the dim (3600x3x38) 3600 points,xyz coordinates,38 "plots" for the animation
set(handles.axes1,'view',[azimuth elevation]);
axis(handles.axes1,[xmin xmax ymin ymax zmin zmax]);
set(handles.axes2,'view',[180 0]);
axis(handles.axes2,[xmin xmax ymin ymax zmin zmax]);
guidata(hObject,handles);
plotA1 = [];
plotA2 = [];
while loop_running
% tic;
if KW+sd>size(KnM,3)
sd=-1;
handles.sd = sd;
elseif KW+sd==0
sd=1;
handles.sd = sd;
end;
KW = KW+sd;
tic;
% create the plot
for colidx = 1:ii_max
pltidx = (clrgrp(:,1,KW)==colidx);
if any(pltidx)
MainPlot = plot3(KnM(pltidx,2,KW),KnM(pltidx,3,KW),KnM(pltidx,4,KW),'o','MarkerEdgeColor','k','MarkerFaceColor',new_rgbmap(colidx,:),'markersize',10);
hold on;
end;
end;
hold off
toc
%assign plot to 2nd variable
[DS2] = deal(MainPlot);
%assigning plots to their axes
if isempty(plotA1)
set(MainPlot,'Parent',handles.axes1);
set(handles.axes1,'view',[azimuth elevation]);
axis(handles.axes1,[xmin xmax ymin ymax zmin zmax]);
else
set(MainPlot,'Parent',handles.axes1);
end;
if isempty(plotA2)
set(DS2,'Parent',handles.axes2);
set(handles.axes2,'view',[180 0]);
axis(handles.axes2,[xmin xmax ymin ymax zmin zmax]);
else
set(DS2,'Parent',handles.axes2);
end;
drawnow
guidata(hObject,handles);
%stop the loop
if ~isempty(stop_ani)
if stop_ani
break;
end;
end;
end;
guidata(hObject,handles);
What happens is, that the animation only runs in the 2nd axes. Propably because of this axes to be the current one all the time. But i thought the Assignment
set(MainPlot,'Parent',handles.axes1);
would update the axeswith the object "MainPlot"?!
If i Add 'Parent',handles.axes1 in the plotting command the plot even only shows one color of points, missing like 90% of the other points on every loop of the animation.
How do I assign the plot properly to multiple axes, without the need to call the plot command multiple times?
Well i could delete all the other axes, leaving only one, so its the only one showing an animation, but I'd like to have the other axes to show different views on the animated object.
I appreciate any help :) Thank you very much in advance
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Specifying Target for Graphics Output についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!