From aaf883a6ad578627c15095320f57aa7feb1465f9 Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Tue, 8 Jan 2008 15:14:27 +0000
Subject: [PATCH] renomme le fichier

---
 tsg_util/writeTsgData.m | 55 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 tsg_util/writeTsgData.m

diff --git a/tsg_util/writeTsgData.m b/tsg_util/writeTsgData.m
new file mode 100644
index 0000000..9948b56
--- /dev/null
+++ b/tsg_util/writeTsgData.m
@@ -0,0 +1,55 @@
+function [error] = tsg_writeTsgData( hTsgGUI, filename)
+% Function to write the TSG data. Should be a NetCDF file
+%
+% Input
+% -----
+% hTsgGUI ............ Handel to the main user interface
+% filename ........... Data filename
+%
+% Output
+% ------
+% error .............. 1: OK - -1 : an error occured
+%
+% The data are store using setappdata - Variable name : 'tsg_data'
+%
+% Function to be rewritten when the NetCDF format will be in use
+% Caution : replace the fill-value with NaN
+%$Id$
+
+% Open the file
+% -------------
+fid = fopen( filename, 'w' );
+
+error = -1;
+if fid ~= -1
+
+    % Get the data from the application GUI
+    % -------------------------------------
+    tsg = getappdata( hTsgGUI, 'tsg_data');
+    
+    [year, month, day, hour, min, sec] = datevec( tsg.TIME );
+    
+    tsg_data = [day month year hour min fix(sec) tsg.LATITUDE ...
+                tsg.LONGITUDE tsg.TEMP_TSG ...
+                tsg.PSAL tsg.PSAL_QC ...
+                tsg.PSAL_ADJ tsg.PSAL_ERR ...
+                ];
+
+    % Write the file
+    % -------------
+    fprintf(fid,...
+    '%02d/%02d/%04d %02d:%02d:%02d %11.6f %11.6f %6.3f %6.3f %1d %6.3f %6.3f\n',...
+     tsg_data');
+    
+    % Clear the Workspace
+    % -------------------
+    clear tsgdata
+    
+    % Close the file
+    % --------------
+    fclose( fid );
+    
+    % Everything OK
+    % -------------
+    error = 1;
+end
-- 
GitLab