diff --git a/1_preprocessing/gtCopyCorrectUndistortCondor.m b/1_preprocessing/gtCopyCorrectUndistortCondor.m
index ab93baf973db4f9893293c4736be5bb311ada884..06f4a6ad10ded34719e88d598d54efc6737e9782 100644
--- a/1_preprocessing/gtCopyCorrectUndistortCondor.m
+++ b/1_preprocessing/gtCopyCorrectUndistortCondor.m
@@ -39,7 +39,7 @@ destdir      = fullfile( parameters.acq.dir, '0_rawdata', parameters.acq.name );
 destdir_orig = fullfile( parameters.acq.dir, '0_rawdata', 'Orig' );
 
 %database connect
-gtDBConnect();
+gtDBConnect('graindb.esrf.fr', 'gtadmin', 'gtadmin', 'graintracking');
 
 filetable=[parameters.acq.name '_filetable'];
 
diff --git a/4_grains/gtCalculateGrain.m b/4_grains/gtCalculateGrain.m
index fffd4089ef28d39b361caa8a483a908a61f6b4a5..0e5565522006a8010151019197065f37c740bd38 100644
--- a/4_grains/gtCalculateGrain.m
+++ b/4_grains/gtCalculateGrain.m
@@ -103,7 +103,7 @@ detrefv = labgeo.detrefv;
 Qdet    = gtFedDetectorProjectionTensor(detdiru,detdirv,1,1);
 tn      = cross(detdiru,detdirv);
 
-pixelsize = [labgeo.pixelsizeu labgeo.pixelsizeu labgeo.pixelsizev];
+pixelsize = mean([labgeo.pixelsizeu labgeo.pixelsizev]);
 
 detpos  = (labgeo.detrefpos./pixelsize)';
 
diff --git a/5_reconstruction/gtAstraReconstructGrain.m b/5_reconstruction/gtAstraReconstructGrain.m
index efbf2038329d60b892d83f040da0e57fbc7bc59d..a67a3365936394a658048a2719cda091250433c8 100644
--- a/5_reconstruction/gtAstraReconstructGrain.m
+++ b/5_reconstruction/gtAstraReconstructGrain.m
@@ -1,4 +1,4 @@
-function vol = gtAstraReconstructGrain(grainID, phaseID, parameters)
+function vol = gtAstraReconstructGrain(grainID, phaseID, parameters, sample)
 % GTASTRARECONSTRUCTGRAIN  3D ART (ASTRA) reconstruction on a GPU machine
 %     gtAstraReconstructGrain(grainID, phaseID, [parameters])
 %     -------------------------------------------------------
@@ -14,23 +14,14 @@ function vol = gtAstraReconstructGrain(grainID, phaseID, parameters)
 %
 
 
-
-% try
-%     d = gpuDevice;
-%     OK = d.SupportsDouble;
-% catch mexc1
-%     mexc = MException('ASTRA:no_GPU', ...
-%                       'gtAstraReconstructGrain: Submit this job on a GPU machine! Exiting...');
-%     mexc = addCause(mexc, mexc1);
-%     throw(mexc)
-% end
-
 if ~exist('parameters','var') || isempty(parameters)
     load('parameters.mat');
 end
 
-samplefile = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
-sample = GtSample.loadFromFile(samplefile);
+if ~exist('sample','var') 
+    samplefile = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');    
+    sample = GtSample.loadFromFile(samplefile);
+end
 
 selected = logical(sample.phases{phaseID}.grains{grainID}.selectedDiffspots); 
 
diff --git a/5_reconstruction/gtChangeThreshold3D.m b/5_reconstruction/gtChangeThreshold3D.m
index 9a08c0616458f501c8f11ec9c195f2fec057a544..ff11f60aa55b6edc8bbab6350c6f7658dd496fc4 100644
--- a/5_reconstruction/gtChangeThreshold3D.m
+++ b/5_reconstruction/gtChangeThreshold3D.m
@@ -24,6 +24,7 @@ if isdeployed
     firstID = str2double(firstID);
     lastID  = str2double(lastID);
     phaseID = str2double(phaseID);
+    gtDBConnect('graindb.esrf.fr','gtadmin','gtadmin','graintracking');
     %     else
     %         % Here is for the lazy who wants to launch from CMD line.
     %         if (ischar(firstID) && strcmpi(firstID, 'first'))
@@ -36,6 +37,17 @@ end
 
 phaseDir = fullfile(parameters.acq.dir, '4_grains', sprintf('phase_%02d', phaseID));
 
+filetable = sprintf('%s_filetable', parameters.acq.name);
+filename = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
+
+if exist(filename, 'file') 
+    sample = GtSample.loadFromFile(filename);     
+else
+    disp('Can not find 4_grains/sample.mat !');
+    exit;
+end
+
+
 if (~isdeployed), fprintf('Phase %02d: ', phaseID); end
 for grainID = firstID : lastID
     if (~isdeployed), fprintf('%04d/(%04d..%04d)', grainID, firstID, lastID); end
@@ -44,17 +56,22 @@ for grainID = firstID : lastID
     grain      = load(grain_file, 'vol', 'shift', 'id');
     grain      = gtThresholdGrain3D(grain, rec);
     seg        = grain.seg;
+    Area       = grain.Area;
     segbb      = grain.segbb;
     threshold  = grain.threshold;
-    Area       = grain.Area;
     
     if ~isempty(seg)
         save(grain_file, '-append', 'seg', 'segbb', 'threshold', 'Area');
+        sample.phases{phaseID}.setBoundingBox(grainID, segbb);
+        sample.phases{phaseID}.setThreshold(grainID, threshold);
     end
     
     if (~isdeployed), fprintf('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b'); end
 end
 if (~isdeployed), fprintf('(%04d..%04d) Done.\n', firstID, lastID); end
 
+disp('now writing to sample.mat')
+sample.mergeToFile(filetable, filename, 'sample');
+
 end % end of function
 
diff --git a/5_reconstruction/gtForwardSimulate_v2.m b/5_reconstruction/gtForwardSimulate_v2.m
index 130cf6f185b5d8daba6f156551695324f0528b10..6f7be299587073acf91b95a3e5b2e63b3f0e42a2 100644
--- a/5_reconstruction/gtForwardSimulate_v2.m
+++ b/5_reconstruction/gtForwardSimulate_v2.m
@@ -94,7 +94,7 @@ detdiru0     = labgeo.detdiru;        % will use detdiru0 to distinguish from ro
 detdirv0     = labgeo.detdirv;
 rotdir       = labgeo.rotdir;
 beamdir      = labgeo.beamdir;
-pixelsize    = [labgeo.pixelsizeu labgeo.pixelsizeu labgeo.pixelsizev];
+pixelsize    = mean([labgeo.pixelsizeu, labgeo.pixelsizev]);
 detrefpos    = labgeo.detrefpos ./ pixelsize;   % detector reference position in pixels
 detposcorner = labgeo.detorig ./ pixelsize;  % the (0,0) corner of the detector in Lab system (edge of detector pixel)
 
@@ -140,6 +140,22 @@ end
 mymcmd    = sprintf('select ldirX, ldirY, ldirZ, omega, omegaB, difAID, difBID from %s ',acq.pair_tablename);
 [allpairs.ldirX, allpairs.ldirY, allpairs.ldirZ, allpairs.omegaA, allpairs.omegaB, allpairs.difAID, allpairs.difBID] = mym(mymcmd);
 
+difspot_num = length(difspotIDs);   % number of difspots in database
+spot2grain  = cell(difspot_num, 1); % cell array linking difspots with grainids
+spot2phase  = cell(difspot_num, 1);
+
+filetable   = sprintf('%s_filetable',acq.name);
+filename    = fullfile(acq.dir,'4_grains','spot2grain.mat');
+spotTable   = GtMergeTable(filetable, filename, {'spot2grain', 'spot2phase'});
+
+samplefile  = fullfile(acq.dir,'4_grains','sample.mat');
+sample      = GtSample(phases_num);
+sample.fileTable = sprintf('%s_filetable',parameters.acq.name);
+% initialise sample structure
+phase = GtPhase(parameters.cryst(phaseID).name, grain_num);
+sample.phases{phaseID} = phase;
+
+
 for n = first : last
     fprintf('\nRunning forward simulation for grain %d...\n',n);
     
@@ -462,9 +478,9 @@ for n = first : last
     out.vol             = [];
     out.segbb           = zeros(1,6);
     out.threshold       = 0;
-    out.shift(1) = round((acq.bb(3)-hsize)/2 + graincenter(1)) + 1;
-    out.shift(2) = round((acq.bb(3)-hsize)/2 + graincenter(2)) + 1;
-    out.shift(3) = round((acq.bb(4)-vsize)/2 + graincenter(3)) + 1;
+    out.shift(1) = round((acq.bb(3)-out.proj.vol_size_x)/2 + graincenter(1)) + 1;
+    out.shift(2) = round((acq.bb(3)-out.proj.vol_size_y)/2 + graincenter(2)) + 1;
+    out.shift(3) = round((acq.bb(4)-out.proj.vol_size_z)/2 + graincenter(3)) + 1;
 
     if fsim.display_figure
         out.full = full;
@@ -475,9 +491,21 @@ for n = first : last
     filename = fullfile(acq.dir, '4_grains', sprintf('phase_%02d',phaseID), ...
                         sprintf('grain_%04d.mat', gr.id));
     save(filename, '-struct', 'out');
+    
+    spot2grain(spotid(included)) = {n};
+    spot2phase(spotid(included)) = {phaseID};
+
+    sample.phases{phaseID}.setR_vector(n, gr.R_vector);
+    sample.phases{phaseID}.setCompleteness(n, completeness);
+    sample.phases{phaseID}.setCenter(n, graincenter);
+    sample.phases{phaseID}.setSelectedDiffspots(n, out.selected);
+   
+end
 
+spotTable.fillTable(spot2grain, 'spot2grain');
+spotTable.fillTable(spot2phase, 'spot2phase');
 
-end
+sample.mergeToFile(filetable, samplefile, 'sample');
 
 end % end of function
 
diff --git a/5_reconstruction/gtReconstructGrains.m b/5_reconstruction/gtReconstructGrains.m
index 5ec54dd47eacdd8751b092d7bab17a62d928a895..9ba1b639b7944df20a6d56229eeb1a0e6b6de8c8 100644
--- a/5_reconstruction/gtReconstructGrains.m
+++ b/5_reconstruction/gtReconstructGrains.m
@@ -50,12 +50,15 @@ if ~OK
     disp('ASTRA:no_GPU   gtAstra3D: You should submit this job on a GPU machine ! Exiting...');
 end
 
+samplefile = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
+sample = GtSample.loadFromFile(samplefile);
+
 if ~isempty(rec.list)
 
     if OK
         for ii = 1 : length(rec.list)
            fprintf('%04d/%04d', ii, length(rec.list));
-           gtAstraReconstructGrain(ii, phaseID, parameters);
+           gtAstraReconstructGrain(ii, phaseID, parameters, sample);
            fprintf('\b\b\b\b\b\b\b\b\b');
         end
     else
@@ -66,7 +69,7 @@ else
     if OK
         for ii = first : last
             fprintf('%04d/(%04d..%04d)', ii, first, last);
-            gtAstraReconstructGrain(ii, phaseID, parameters);
+            gtAstraReconstructGrain(ii, phaseID, parameters, sample);
             fprintf('\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b');
         end
     else
diff --git a/5_reconstruction/gtSetupForwardSimulation.m b/5_reconstruction/gtSetupForwardSimulation.m
index aae1ca7974eeb1937f34a732a2b36f7be51151fc..579ef6a30cd45d164722cef073b004d6143ef072 100644
--- a/5_reconstruction/gtSetupForwardSimulation.m
+++ b/5_reconstruction/gtSetupForwardSimulation.m
@@ -1,45 +1,59 @@
-function gtSetupForwardSimulation(phaseID)
+function gtSetupForwardSimulation
 % simple helper function to run gtForwardSimulate
 % whatever the current version is ;-)
 
 
 parameters = [];
 load('parameters.mat');
+gtDBConnect();
 nof_phases = length(parameters.cryst);
 
-if ~exist('phaseID','var')
+if nof_phases > 1
+    phaseID = inputwdefaultnumeric('Enter phaseID', num2str(1));   
+else
     phaseID = 1;
 end
-phaseID_str = sprintf('%02d',phaseID);
 
-disp(['Setting up Forward Simulation for phase ' phaseID_str ' ' parameters.cryst(1).name]);
+phaseID_str = sprintf('%02d',phaseID);
 
+disp(['Setting up Forward Simulation for phase ' phaseID_str ' ' parameters.cryst(phaseID).name]);
+filetable = sprintf('%s_filetable', parameters.acq.name);
 % get the latest version of indexter output
 grain = [];
 filename = fullfile(parameters.acq.dir, '4_grains', ['phase_' phaseID_str], 'index.mat');
+
 load(filename, 'grain');
 % how many grains in this dataset?
 ngrains = length(grain);
 
-% sample.mat unused in gtForwardSimulate_v2!!! So no reason to load it here :)
-
-% create / reset sample.mat spot2grain.mat
-% filename = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
-% if exist(filename, 'file')
-%     sample = GtSample.loadFromFile(filename);     % do not create from scratch - we want to keep information related to other phases
-% else
-%     sample = GtSample(nof_phases);
-% end
-% 
-% phase = GtPhase(parameters.cryst(phaseID).name, ngrains);
-% sample.phases{phaseID} = phase;
-% save(filename, 'sample');
-% disp(['Reset phase number ' num2str(phaseID) ' in the sample.mat:'])
-% disp(['Name : ' parameters.cryst(phaseID).name])
-% disp(['nof_grains: ' ngrains])
-% 
-% filename    = fullfile(parameters.acq.dir,'4_grains','spot2grain.mat');
-% spotTable   = GtMergeTable(filename, {'spot2grain', 'spot2phase'});
+
+%create / reset sample.mat spot2grain.mat
+filename = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
+if exist(filename, 'file') && (nof_phases > 1)
+    sample = GtSample.loadFromFile(filetable, filename);     % do not create from scratch - we want to keep information related to other phases
+else
+    sample = GtSample(nof_phases);
+    sample.fileTable = sprintf('%s_filetable',parameters.acq.name);
+end
+
+phase = GtPhase(parameters.cryst(phaseID).name, ngrains);
+sample.phases{phaseID} = phase;
+save(filename, 'sample');
+disp(['Reset phase number ' num2str(phaseID) ' in the sample.mat:'])
+disp(['Name : ' parameters.cryst(phaseID).name])
+disp(['nof_grains: ' num2str(ngrains)])
+
+
+filename    = fullfile(parameters.acq.dir,'4_grains','spot2grain.mat');
+difspot_num  = mym(sprintf('select count(*) from %sdifspot', parameters.acq.name));
+
+if exist(filename, 'file') && nof_phases>1 
+    check = inputwdefault('Do you want to reset spot2grain? [y/n]', 'n');
+    if ~strcmpi(check, 'y')
+        spot2grain  = cell(difspot_num, 1); % cell array linking difspots with grainids
+        spot2phase  = cell(difspot_num, 1);
+    end
+end
 
 % get reconstruction parameters
 check = inputwdefault('Use default parameters? [y/n]', 'y');
diff --git a/5_reconstruction/gtSetupReconstruction.m b/5_reconstruction/gtSetupReconstruction.m
index b590be24b4e7e033f1df18d5ff3a5a221bafc203..baa76f5c65e245e92674edf103f107ffc83462e3 100644
--- a/5_reconstruction/gtSetupReconstruction.m
+++ b/5_reconstruction/gtSetupReconstruction.m
@@ -45,18 +45,22 @@ parameters_savefile = fullfile(parameters.acq.dir, 'parameters.mat');
 
 nof_phases = length(parameters.cryst);
 
+if nof_phases > 1
+    phaseID = inputwdefaultnumeric('Enter phaseID', num2str(1));    
+end
+
+phaseID_str = sprintf('%02d',phaseID);
+
+
 disp(['Setting up Reconstruction for phase ' num2str(phaseID) ' (' parameters.cryst(phaseID).name ')']);
 
+filetable = sprintf('%s_filetable', parameters.acq.name);
 samplefile = fullfile(parameters.acq.dir, '4_grains', 'sample.mat');
 if exist(samplefile, 'file')
-    check=inputwdefault('4_grains/sample.mat already exists - do you want to reinitialize it ? [y/n]','n');
-    if strcmpi(check,'y')
-        sample = GtSample();
-    else
-       sample = GtSample.loadFromFile(samplefile);
-    end
+   sample = GtSample.loadFromFile(samplefile);   
 else
-       sample = GtSample();
+   disp('Can not find 4_grains/sample.mat - have you run gtSetupForwardSimulation ?');
+   exit;
 end
 
 absorption_volume = fullfile(parameters.acq.dir, '5_reconstruction', 'volume_absorption.mat');
@@ -83,12 +87,8 @@ if ~exist(absorption_mask,'file')
 end
 
 
-% get the latest version of indexter output 
-filename = fullfile(parameters.acq.dir, '4_grains', sprintf('phase_%02d', phaseID), 'index.mat');
-load(filename);
-% how many grains in this dataset?
-first = 1;
-last  = length(grain);
+
+
 
 
 % get reconstruction parameters
@@ -99,6 +99,8 @@ if ~strcmpi(check, 'y')
     save(parameters_savefile,'parameters');
 end
 
+first = 1;
+last  = length(sample.phases{phaseID}.grains);
 
 check = inputwdefault('Launch reconstruction? [y/n]', 'y');
 if  strcmpi(check, 'y')
diff --git a/zUtil_DataStructures/GtConflict.m b/zUtil_DataStructures/GtConflict.m
index df7f717701c29b0676d163655f2c24418c35f501..018d7809118bc56bb174100de633ea4e261299ba 100644
--- a/zUtil_DataStructures/GtConflict.m
+++ b/zUtil_DataStructures/GtConflict.m
@@ -1,9 +1,9 @@
 classdef GtConflict
     
     properties
-        difspots   = {};
+        difspots   = NaN;  %{} before...
         maxnum     = false;
-        merge      = {};
+        merge      = NaN;  %{} before...
         allequals  = false;
     end
 end
diff --git a/zUtil_DataStructures/GtLockDB.m b/zUtil_DataStructures/GtLockDB.m
index 6e07c61a6fff89c20da608bde8aeccea9aeaf2b8..bcb7d25ea46a911a23719acf584b0b7cf980b786 100644
--- a/zUtil_DataStructures/GtLockDB.m
+++ b/zUtil_DataStructures/GtLockDB.m
@@ -62,10 +62,10 @@ classdef GtLockDB < handle
             if (obj.hasLock)
                 test = mym(sprintf('delete from %s where (filename) = ("%s")', obj.filetable, obj.filename));
                 if test
-                    disp('release file lock')
+                    %disp('release file lock')
                     obj.hasLock = false;
                 else
-                    disp('release file lock failed');
+                    disp('releasing file lock failed for some reason !!?');
                 end
             end
         end
diff --git a/zUtil_DataStructures/GtMergeTable.m b/zUtil_DataStructures/GtMergeTable.m
index 9f62e94bd7bf6e9201c15db525afb9f392df27f0..f30ba3b62973cd6654855131f5c8337b73fa2838 100644
--- a/zUtil_DataStructures/GtMergeTable.m
+++ b/zUtil_DataStructures/GtMergeTable.m
@@ -7,18 +7,9 @@ classdef GtMergeTable < handle
 
     methods (Access = public)
 
-        function obj = GtMergeTable(fileName, fieldNames)
-            obj.fileLock = GtLock(fileName);
-            obj.fieldNames  = fieldNames;
-            if ~exist(fileName,'file')
-                fprintf('creating output file\n')
-           
-                for ii = 1 : length(fieldNames)
-                    table.(obj.fieldNames{ii}) = {};
-                end
-                  
-                save(fileName, '-struct', 'table');
-            end
+        function obj = GtMergeTable(fileTable, fileName, fieldNames)
+            obj.fileLock = GtLockDB(fileTable,fileName);
+            obj.fieldNames  = fieldNames
         end
 
         function fillTable(obj, tmp_array, fieldName)
diff --git a/zUtil_DataStructures/GtSample.m b/zUtil_DataStructures/GtSample.m
index 6e11ec8466735020adb026166a08e9f92cad9291..471f600db8784d720a23fb6029b002f15f548619 100644
--- a/zUtil_DataStructures/GtSample.m
+++ b/zUtil_DataStructures/GtSample.m
@@ -5,6 +5,8 @@ classdef GtSample < handle
         volumeFile = '';
 
         absVolFile = '';
+        
+        fileTable = '';
     end
 
     methods (Access = public)
@@ -24,6 +26,9 @@ classdef GtSample < handle
             for ii = 1: phases_num
                 obj.phases{ii} = GtPhase();
             end
+            if (exist('fileTable', 'var'))
+                obj.fileTable = fileTable;
+            end    
         end
 
         function merge(obj, other)
@@ -41,9 +46,11 @@ classdef GtSample < handle
                 for grainNum = 1:length(other.phases{phaseNum}.grains)
                     % Merge threshold
                     obj.mergeGrainField(other, phaseNum, grainNum, 'threshold', 0);
-                    obj.phases{phaseNum}.grains{grainNum}.selectedDiffspots = ...
-                        unique([obj.phases{phaseNum}.grains{grainNum}.selectedDiffspots ...
-                                other.phases{phaseNum}.grains{grainNum}.selectedDiffspots]);
+                    if ~isempty(other.phases{phaseNum}.grains{grainNum}.selectedDiffspots)
+                        obj.phases{phaseNum}.grains{grainNum}.selectedDiffspots = ...
+                            other.phases{phaseNum}.grains{grainNum}.selectedDiffspots;
+                    end    
+                    %removed :  unique([obj.phases{phaseNum}.grains{grainNum}.selectedDiffspots ...
                 end
                 for grainNum = 1:length(other.phases{phaseNum}.summary)
                     obj.mergeSummaryField(other, phaseNum, grainNum, 'delete', false);
@@ -55,9 +62,9 @@ classdef GtSample < handle
                     obj.mergeSummaryField(other, phaseNum, grainNum, 'difspotID', []);
                 end
                 for grainNum = 1:length(other.phases{phaseNum}.conflicts)
-                    obj.mergeConflictsField(other, phaseNum, grainNum, 'difspots', {});
+                    obj.mergeConflictsField(other, phaseNum, grainNum, 'difspots', []);  %{}
                     obj.mergeConflictsField(other, phaseNum, grainNum, 'maxnum', false);
-                    obj.mergeConflictsField(other, phaseNum, grainNum, 'merge', {});
+                    obj.mergeConflictsField(other, phaseNum, grainNum, 'merge', []);     %{}
                     obj.mergeConflictsField(other, phaseNum, grainNum, 'allequals', false);
                 end
                 
@@ -80,7 +87,7 @@ classdef GtSample < handle
             end
         end
 
-        function mergeToFile(obj, fileName, fieldName)
+        function mergeToFile(obj, fileTable, fileName, fieldName)
         % GTSAMPLE/MERGETOFILE This merges the current object into an existing
         % object, which is loaded from a file.
         %
@@ -91,8 +98,8 @@ classdef GtSample < handle
             if (~exist('fieldName', 'var'))
                 fieldName = 'sample';
             end
-
-            lock = GtLock(fileName);
+         
+            lock = GtLockDB(fileTable, fileName);
             lock.acquire();
 
             sample = load(fileName, fieldName);
@@ -201,14 +208,14 @@ classdef GtSample < handle
     end
 
     methods (Static, Access = public)
-        function sample = loadFromFile(fileName, fieldName)
+        function sample = loadFromLockedFile(fileTable, fileName, fieldName)
         % GTSAMPLE/LOADFROMFILE Synchronized loading from a file
 
             if (~exist('fieldName', 'var'))
                 fieldName = 'sample';
             end
 
-            lock = GtLock(fileName);
+            lock = GtLockDB(fileTable, fileName);
             lock.acquire();
 
             sample = load(fileName, fieldName);
@@ -216,5 +223,17 @@ classdef GtSample < handle
 
             lock.release();
         end
+        
+        function sample = loadFromFile(fileName, fieldName)
+        % GTSAMPLE/LOADFROMFILE Synchronized loading from a file
+
+            if (~exist('fieldName', 'var'))
+                fieldName = 'sample';
+            end
+            
+            sample = load(fileName, fieldName);
+            sample = sample.(fieldName);
+
+        end 
     end
 end