GUI axes only plots the last values in a for loop!

1 view (last 30 days)
I am trying to plot values in an axes inside GUI in matlab. The code must load 18000*132 matrix and scatter plot few columns for 18000 times. For test purpose, I wrote the code to plot two scatter plot from the matrix for 200 times. The code works fine if i run it in a normal .mat file but it doesn't work properly if I run it inside GUI axes. The GUI code shows no error but plot only once and it's the 200th value's plot. I am new in matlab GUIDE.
Any help to solve the problem is highly appreciated.
function open_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
ax1 = handles.axes1;
load('PMelisa01.mat', 'PMelisaD20180404Walkingnone01');
MelisaW = cell2mat(PMelisaD20180404Walkingnone01);
for i=1:200
PMelisaD20180404Head_x= MelisaW(i,4)/100;
PMelisaD20180404Head_y= MelisaW(i,5)/100;
PMelisaD20180404Head_z= MelisaW(i,6)/100;
%2
PMelisaD20180404Head_End_x=MelisaW(i,10)/100;
PMelisaD20180404Head_End_y=MelisaW(i,11)/100;
PMelisaD20180404Head_End_z=MelisaW(i,12)/100;
scatter3(ax1,PMelisaD20180404Head_x,PMelisaD20180404Head_y,PMelisaD20180404Head_z,'filled')
hold on
scatter3(ax1,PMelisaD20180404Head_End_x,PMelisaD20180404Head_End_y,PMelisaD20180404Head_End_z,'filled')
hold off
drawnow
end
guidata(hObject, handles);

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!