Multiple Comet Plots in GUI
10 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am trying to create a GUI with four different plots, three of which are comets that have to run at the same time. I have the code ready separately and I know that everytime a subplot with one of the comet plots is running everything is paused until the job is done and then the same for the next comet. Is there anyway I can make the comets run at the same time? and why can I not see the comets happening in GUI? I know I am absolutely new to GUI and have no idea how it works, but I donot understand what happens in the GUI that it shows rubbish as comets...
My code (in the GUI) is:
function Run_Callback(hObject, eventdata, handles)
% hObject handle to Run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get user input and calculate the values:
data = handles.data;
% Locate the pen-up data:
penup_idx = data(:,6) < 0.1;
% Time:
time = data(:,1);
% Rescaling:
xcoord = data(:,2) * 20.32;
ycoord = data(:,3) * 15.24;
% Velocity:
Vt = zeros(length(data),1); % Instant velocity vector
temp0 = (diff(sqrt(xcoord.^2 + ycoord.^2)));
temp1 = cat(1,0,temp0);
Vt = abs((temp1(1:end,1))./(time(1:end,1)));
Vt(1,1) = 0;
% Drawing the Spiral Pentagon:
axes(handles.Drawing);
a = plot(xcoord,ycoord,'r');
axis off
box off
set(gcf,'PaperPositionMode','auto');
print('PeaksSurface','-dpng','-r0');
axis tight;
hold on
tic
drawnow
comet(xcoord,ycoord);
toc
plot(xcoord,ycoord,'r');
axis tight;
hold off
% Drawing X & Y Coordinates independently:
axes(handles.Coordinates);
tic
drawnow
multicomet([xcoord,ycoord]);
toc
hold on
plot([xcoord,ycoord]);
hold off
% Drawing Velocity:
axes(handles.Velocity);
tic
drawnow
axis tight;
comet(Vt);
toc
hold on
plot(Vt);
axis tight;
hold off
% Image Comparison
axes(handles.Pix);
template = imread('Spiral_template Editted.png');
drawing = imread('plot.png');
% Resizing the second image to match the size of the first image:
[rowsA colsA RGBA]=size(template);
[rowsB colsB RGBB]=size(drawing);
C=imresize(drawing,[rowsA colsA]);
imshowpair(template,C,'blend','Scaling','joint');
and my normal code is:
Vt = zeros(length(data),1); % Instant velocity vector
temp0 = (diff(sqrt(xcoord.^2 + ycoord.^2)));
temp1 = cat(1,0,temp0);
Vt = abs((temp1(1:end,1))./(time(1:end,1)));
Vt(1,1) = 0;
figure;
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full screen.
a = plot(xcoord,ycoord,'r');
axis tight;
axis off
box off
set(gcf,'PaperPositionMode','auto');
print('PeaksSurface','-dpng','-r0');
print('PeaksSurface','-dpng');
figure;
set(gcf, 'Position', get(0,'Screensize')); % Enlarge figure to full screen.
subplot (2,2,1);
a = plot(xcoord,ycoord,'r');
axis tight;
axis off
box off
title('Subject"s Drawing', 'FontSize', fontSize);
hold on
tic
drawnow
comet(xcoord,ycoord);
toc
plot(xcoord,ycoord,'r');
axis tight;
hold off
subplot (2,2,2);
tic
drawnow
multicomet([xcoord,ycoord]);
toc
hold on
plot([xcoord,ycoord]);
hold off
title('X & Y Coordinates', 'FontSize', fontSize);
subplot (2,2,3);
tic
drawnow
axis tight;
comet(Vt);
toc
hold on
plot(Vt);
axis tight;
hold off
title('Instant Velocity', 'FontSize', fontSize);
subplot (2,2,4);
template = imread('Spiral_template.png');
drawing = imread('PeaksSurface.png');
% Resizing the second image to match the size of the first image:
[rowsA colsA RGBA]=size(template);
[rowsB colsB RGBB]=size(drawing);
C=imresize(drawing,[rowsA colsA]);
imshowpair(template,C,'blend','Scaling','joint');
title('Comparison with the Template', 'FontSize', fontSize);
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Orange についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!