diff --git a/tsg_util/tsg_initialisation.m b/tsg_util/tsg_initialisation.m index b5a60c669ccfdcdb989c2f2a4fffb5907bc92f1b..1da7a35be6b4653a7fe96fc12ad383f98ba55714 100644 --- a/tsg_util/tsg_initialisation.m +++ b/tsg_util/tsg_initialisation.m @@ -1,13 +1,12 @@ -function tsg = tsg_initialisation() -%function tsg_initialisation(hTsgGUI) +function tsg_initialisation(hMainFig) % % Input % ----- -% none +% hMainFig ............ Handel to the main user interface % % Output % ------ -% tsg ............ tsg structure that contain data +% none % % $Id$ % @@ -15,6 +14,7 @@ function tsg = tsg_initialisation() % ------------------------------------------------------------------------- %% Constants for NetCDF DATA FORMAT TSG % ------------------------------------------------------------------------- +tsg = []; % netcdf file version % ------------------- @@ -166,3 +166,6 @@ tsg.DATE_CREATION = [date(1:8) date(10:15)]; tsg.DATE_UPDATE = tsg.DATE_CREATION; tsg.REFERENCE_DATE_TIME = REFERENCE_DATE_TIME; +% Save tsg structure +% ------------------ +setappdata( hMainFig, 'tsg_data', tsg); diff --git a/tsg_util/tsg_preferences.m b/tsg_util/tsg_preferences.m index 1820ace18c797663cabb633a6af0b7cef4adc118..7ef192bdcb06ec72fec0c0eab2088f5e4b7fba85 100644 --- a/tsg_util/tsg_preferences.m +++ b/tsg_util/tsg_preferences.m @@ -126,8 +126,12 @@ set(0, 'userdata', root); % call default tsg_initialisation % ------------------------------- - tsg = tsg_initialisation; + tsg_initialisation(hTsgGUI); + % Get the data from the application GUI + % ------------------------------------- + tsg = getappdata( hTsgGUI, 'tsg_data'); + % init root structure to default values % ------------------------------------- root.preference.autoload = 'off'; diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m index 8a702f1173f6d65824edfc0ba7bdd05a48735273..d127ebe36b01455a9d580e133c3aa99587269bc0 100644 --- a/tsgqc_GUI.m +++ b/tsgqc_GUI.m @@ -101,9 +101,6 @@ hMainFig = figure(... 'Position',guiLimits, ... 'Color', get( 0, 'DefaultUIControlBackgroundColor' )); -% Initialize tsg structure -% ------------------------ -% tsg_initialisation(hMainFig) %% Initialize tsg structure with tsg_preference function % ----------------------------------------------------- @@ -1017,6 +1014,10 @@ end % construct valid and full file path % ----------------------------------- fullFileName = strcat(pathname, fileName); + + % call default tsg_initialisation + % ------------------------------- + tsg_initialisation(hMainFig); % Read the data % ------------- @@ -1085,13 +1086,15 @@ end % --------------------------- set( hInfoFileText, 'String', strcat(tsg.file.name, tsg.file.ext)); - % update some fields in tsg structure - % ----------------------------------- + % update some fields in tsg structure and restore tsg + % --------------------------------------------------- updateTsgStruct(hMainFig); + tsg = getappdata( hMainFig, 'tsg_data'); % Running average of TSG time series % ---------------------------------- tsg_moveaverage(hMainFig); + % The callback to detect the mouse motion can be set to on % --------------------------------------------------------