From c0b5c7227b06448a43a6f1eaf2b77356f61b444d Mon Sep 17 00:00:00 2001 From: "Vasco Carvalho Abrantes Fonseca (carvalh8)" Date: Sat, 25 Jul 2020 22:22:15 +0100 Subject: [PATCH] 1.11 Created two buttons to pause and resume the visualization --- BigData.m | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/BigData.m b/BigData.m index 5af056e..5c9295f 100644 --- a/BigData.m +++ b/BigData.m @@ -49,18 +49,19 @@ function display() longitude = ncread(ncfile,'lon'); %% longitude variable latitude = ncread(ncfile,'lat'); %% latitude variable time = ncread(ncfile,'hour'); %% time variable - timel = length(time) ; %% length of the time variable + timel = length(time)*10 ; %% length of the time variable clc; [X,Y] = meshgrid(longitude,latitude) ; figure('Name', titlechoice,'NumberTitle','off'); %%formats the figure info shown set(gcf, 'Position', get(0, 'Screensize')); %% fullscreen clf; - uicontrol( 'Position', [30 140 100 30],'String','Exit','Callback',@(src,evnt)quit ); %Call the exit function if pressed - uicontrol( 'Position', [30 190 100 30],'String','Colour Blindness','Callback',@(src,evnt)colour_blindness); %Call the colour_blindness function if pressed - uicontrol( 'Position', [30 220 100 30],'String','Menu','Callback',@(src,evnt)menu_back); %Call the menu_back function if pressed - uicontrol( 'Position', [30 250 100 30],'String','Start/Restart','Callback',@(src,evnt)start); %Call the menu_back function if pressed - + uicontrol( 'Position', [30 140 180 40],'String','Exit','Callback',@(src,evnt)quit ); %Call the exit function if pressed + uicontrol( 'Position', [30 190 180 40],'String','Colour Blindness','Callback',@(src,evnt)colour_blindness); %Call the colour_blindness function if pressed + uicontrol( 'Position', [30 230 180 40],'String','Menu','Callback',@(src,evnt)menu_back); %Call the menu_back function if pressed + uicontrol( 'Position', [30 310 180 40],'String','Start/Restart','Callback',@(src,evnt)start); %Call the menu_back function if pressed + uicontrol( 'Position', [30 270 88 40],'String','Resume','Callback',@(src,evnt)resume); %Call the menu_back function if pressed + uicontrol( 'Position', [122 270 88 40],'String','Pause','Callback',@(src,evnt)wait); %Call the menu_back function if pressed info = 1; clc; @@ -96,27 +97,33 @@ function display() title(sprintf('Hour: %d',time(i))) %% Show the hours above the map. clc; - pause(1) %% Pause of 1 seconds but can change depends of the hardware. + pause(0.5) end end + + function wait() + uiwait() %% Stops + end + function resume() + uiresume() %%Resumes + end function quit() - pause(1) - close all % Closes all windows + close all %% Closes all windows end function colour_blindness() %% Menu to the color accessibility options info = menu('Color Accessibility Options', 'Default', 'Protanopia','Deuteranopia','Tritanopia','Monochromacy'); if info == 1 - colormap default; %%default colors + colormap default; %% Default colors elseif info == 2 - colormap winter; %%Protanopia colors. + colormap winter; %% Protanopia colors. elseif info == 3 - colormap cool; %%Deuteranopia colors. + colormap cool; %% Deuteranopia colors. elseif info == 4 - colormap copper; %%Tritanopia colors. + colormap copper; %% Tritanopia colors. elseif info == 5 - colormap bone; %%Greyscale + colormap bone; %% Greyscale end clc; end @@ -148,6 +155,6 @@ function display() titlechoice = 'silam_ozone'; end clc; - ozone_end = ncread(ncfile, showtype); % reads one specific model from the combined file depending on the user choice in the menu above. + ozone_end = ncread(ncfile, showtype); % Reads one specific model from the combined file depending on the user choice in the menu above. end end