diff --git a/tsg_util/shipVelocity.m b/tsg_util/shipVelocity.m
new file mode 100644
index 0000000000000000000000000000000000000000..bc759c32947bfeaf9ec7d0e8a5f46a116e33b24d
--- /dev/null
+++ b/tsg_util/shipVelocity.m
@@ -0,0 +1,27 @@
+function shipVelocity( hMainFig )
+%
+% Compute the ship velocity
+%
+
+% Get the data from the application GUI
+% -------------------------------------
+tsg = getappdata( hMainFig, 'tsg_data');
+
+% Compute ship velocity from positions if sog not available
+% ---------------------------------------------------------
+if isempty(tsg.SPDC)
+  range    = m_lldist(tsg.LONX,tsg.LATX);
+  ind      = size(tsg.DAYD);
+  tsg.SPDC = zeros(size(ind));
+
+  for i=1:length(tsg.DAYD)-1
+    tsg.SPDC(i) = range(i) / ((tsg.DAYD(i+1)-tsg.DAYD(i)) * 24 * 1.854);
+  end
+  tsg.SPDC = [tsg.SPDC';0];
+end
+
+% Save tsg structure
+% ------------------
+setappdata( hMainFig, 'tsg_data', tsg);
+
+end
diff --git a/tsg_util/updateTsgStruct.m b/tsg_util/updateTsgStruct.m
index bd5261eb571c5b2f780938866f4f52a66f9cb9ea..34500d5d60a170b9efc9dd9a310b0cb840098776 100644
--- a/tsg_util/updateTsgStruct.m
+++ b/tsg_util/updateTsgStruct.m
@@ -9,6 +9,13 @@ function updateTsgStruct(hMainFig)
 %
 % $Id$
 
+
+% Compute ship velocity from positions if sog not available
+% Must be done first as we use getappdata and setappdata within
+% the function
+% ---------------------------------------------------------
+shipVelocity( hMainFig );
+
 % Get the data from the application GUI
 % -------------------------------------
 tsg = getappdata( hMainFig, 'tsg_data');
@@ -16,6 +23,10 @@ tsg = getappdata( hMainFig, 'tsg_data');
 nPARA = 2;
 PARA  = ['SSPS'; 'SSJT'];
 
+% Get NO_CONTROL and INTERPOLATED_VALUE codes
+% -------------------------------------------
+NO_CONTROL = get(tsg.qc.hash, 'NO_CONTROL', 'code');
+
 % get min and max values for position and set to globals attributes
 % -----------------------------------------------------------------
 tsg.SOUTH_LATX = min(tsg.LATX);
@@ -30,28 +41,17 @@ tsg.DATE_START = [date(1:8) date(10:15)];
 date           = datestr(max(tsg.DAYD),30);
 tsg.DATE_END   = [date(1:8) date(10:15)];
 
-% Compute ship velocity from positions if sog not available
-% ---------------------------------------------------------
-if isempty(tsg.SPDC)
-  range    = m_lldist(tsg.LONX,tsg.LATX);
-  ind      = size(tsg.DAYD);
-  tsg.SPDC = zeros(size(ind));
-  
-  for i=1:length(tsg.DAYD)-1
-    tsg.SPDC(i) = range(i) / ((tsg.DAYD(i+1)-tsg.DAYD(i)) * 24 * 1.854);
-  end
-  tsg.SPDC = [tsg.SPDC';0];
-end
-
-% Varaibles must exists
+% Variables must exists
 % ---------------------
 for i = 1: nPARA
 
   para1 =  PARA(i,:);
-  if isempty( tsg.(para1) )
-    msgbox(['You must initialise the tsg.' PARA(i,:) ' variable'],...
-      'function ''updateTsgStruct''', ....
-      'warn', 'modal');
+  if ~isempty( tsg.(para1) ) && isempty( tsg.([para1 '_QC']) )
+
+    % If QC variables are emptied, fill them with NO_CONTROL code value
+    % -----------------------------------------------------------------
+    tsg.([para1 '_QC']) = castByteQC( NO_CONTROL, tsg.DAYD );
+
   end
 end
 
@@ -84,7 +84,8 @@ if isempty(tsg.SSTP_LINCOEF)
   tsg.SSTP_LINCOEF(2) = 0;
 end
 
-% Save tsg structure 
+% Save tsg structure
 % ------------------
 setappdata( hMainFig, 'tsg_data', tsg);
- 
\ No newline at end of file
+
+end