diff --git a/matlab/IMAS/G_ITER_generator.m b/matlab/IMAS/G_ITER_generator.m
new file mode 100644
index 0000000000000000000000000000000000000000..bc4a0f91c09d84527ff42fcb0430ec4e8f9f0cc3
--- /dev/null
+++ b/matlab/IMAS/G_ITER_generator.m
@@ -0,0 +1,61 @@
+function G = G_ITER_generator()
+G = struct();
+
+tmp = data_Bm();
+
+G.rm = tmp.r;
+G.zm = tmp.z;
+G.am = tmp.am;
+G.nm = numel(G.zm);
+
+tmp = data_Ff();
+G.rf = tmp.r;
+G.zf = tmp.z;
+G.nf = numel(G.zf);
+
+tmp = data_limiter();
+G.rl  = tmp.r;
+G.zl = tmp.z;
+
+% TODO vessel is ready but will be added in a second moment
+G.rv = [];
+G.zv = [];
+
+% Point for the gaps
+tmp = data_rW();
+G.rW = tmp.r;
+G.zW = tmp.z;
+G.oW = tmp.oW;
+G.aW = tmp.aW;
+
+%% Coils
+tmp = data_coils();
+R = tmp.R;
+Z = tmp.Z;
+dR = tmp.dR;
+dZ = tmp.dZ;
+N = tmp.N;
+dima= tmp.names;
+
+%% Sort by CORSICA ordering for the structure liux
+% Not all che coils are used in this 
+% Matrix to be given to eval_trap
+vvtmp = [R';Z';dR';dZ'];
+% Sort for Corsica convention
+vv = zeros(size(vvtmp));
+sort_list = [3,4,2,5,1,6,7,8,9,10,11,12, 13, 14];
+for ii=1:numel(sort_list)
+    vv(:,ii) = vvtmp(:,sort_list(ii));
+end
+N = N(sort_list);
+% Compute the windings and connection matrix
+[rw,zw,Twa] = gen_filament(vv,N,2);
+G.dima = dima(sort_list);
+
+G.rw = rw;
+G.zw = zw;
+G.Twa = Twa;
+G.na = numel(R);
+G.Tvs = [];
+
+end
diff --git a/matlab/IMAS/LLXLY_IDS_corsica.m b/matlab/IMAS/LLXLY_IDS_corsica.m
new file mode 100644
index 0000000000000000000000000000000000000000..432cc8ad04d4006932f10f4e5b29df04b7df2250
--- /dev/null
+++ b/matlab/IMAS/LLXLY_IDS_corsica.m
@@ -0,0 +1,142 @@
+function [L,LX,LY] = LLXLY_IDS_corsica(L_LIU, a)
+%% Load data drom IDS
+
+
+% Get geomtrical information from the existing LIUQE
+L = struct();
+L.P = L_LIU.P;
+fieldlist = {'rl';'zl'; 'rw';'zw'; 'Twa'; 'rv';'zv'; 'Tvs'; 'rf'; 'zf';'rm'; 'zm'; 'am'};
+for  field = fieldlist.'
+   L.G.(field{1})  = L_LIU.G.(field{1});
+end
+
+% Set new grid
+L.G.rx = a.equilibrium.time_slice{1}.profiles_2d{1}.grid.dim1;
+L.G.zx = a.equilibrium.time_slice{1}.profiles_2d{1}.grid.dim2;
+L.P.pq = sqrt((a.equilibrium.time_slice{1}.profiles_1d.psi - a.equilibrium.time_slice{1}.global_quantities.psi_axis)/(a.equilibrium.time_slice{1}.global_quantities.psi_boundary - a.equilibrium.time_slice{1}.global_quantities.psi_axis));
+
+% Recompute the geometrical quantities for the CORSICA grid
+L.G = liug(L.G,L.P);
+L = liuc(L.P, L.G); 
+
+[rrx, zzx] = meshgrid(L.G.rx, L.G.zx);
+
+%%  Get LX structure
+% {Ia, Ip, rBt} available
+% Ff, Bm, Ft recomputed
+
+LX.t = a.pf_active.coil{1}.current.time;
+LX.nt = numel(LX.t);
+
+LX.Ip = zeros(LX.nt,1);
+for ii=1:LX.nt
+    LX.Ip(ii) = a.equilibrium.time_slice{ii}.global_quantities.ip;
+end
+
+% Ia is the current per number of turns
+LX.Ia = zeros(L.G.na, LX.nt);
+for ii= 1:L.G.na
+   LX.Ia(ii,:) = a.pf_active.coil{ii}.current.data/sum(L.G.Twa(:,ii));
+end
+
+LX.rBt = zeros(LX.nt,1);
+LX.rBt(:) = a.equilibrium.vacuum_toroidal_field.r0*a.equilibrium.vacuum_toroidal_field.b0;
+
+
+%% Synthetic data that needs to be recomputed
+LY.Ix = zeros( L.nzx, L.nrx ,LX.nt);
+for tt=1:LX.nt
+    LY.Ix(:,:,tt) = a.equilibrium.time_slice{tt}.profiles_2d{1}.j_tor./rrx*L.drx*L.dzx*1e-2; % Wrong definition in IDS Corsica
+   % Ix_Corsica(:,:,tt) = a.equilibrium.time_slice{tt}.profiles_2d{1}.j_tor; % Wrong definition of CORSICA
+   % Ix_Corsica(:,:,tt) = -Ix_Corsica(:,:,tt)*abs(LX.Ip(tt)/sum(sum(Ix_Corsica(:,:,tt))));
+end
+
+
+LX.Bm = zeros(L.G.nm, LX.nt);
+for tt= 1:LX.nt
+    LX.Bm(:,tt) = L.G.Bmx*reshape(LY.Ix(:,:,tt), L.nrx*L.nzx,1 )  + L.G.Bma*LX.Ia(:,tt);
+end
+
+LX.Ff = zeros(L.G.nf, LX.nt);
+for tt= 1:LX.nt
+    LX.Ff(:,tt) =  L.G.Mfx*reshape(LY.Ix(:,:,tt), L.nrx*L.nzx,1 )  + L.G.Mfa*LX.Ia(:,tt);
+end
+
+LX.Is = zeros(0,LX.nt);
+
+LX.shot = 5000;
+
+LY.Fx = zeros(L.nzx,L.nrx ,LX.nt);
+for tt = 1:LX.nt
+   LY.Fx(:,:,tt) =  a.equilibrium.time_slice{tt}.profiles_2d{1}.psi;
+end
+
+% Normalized flux of the R,Z grid
+LY.Opy = zeros(L.nzy, L.nry, LX.nt);
+LY.FNy = zeros(L.nzy, L.nry, LX.nt);
+for tt=1:LX.nt
+[LY.rA(tt),LY.zA(tt),LY.FA(tt),dr2FA,dz2FA,drzFA,rX,zX,~,~,~,~,rl,zl,...
+    LY.rB(tt),LY.zB(tt),LY.FB(tt),LY.lB(tt),LY.lX(tt),LY.Opy(:,:,tt)] = meqpdom(LY.Fx(:,:,tt),LX.Ip(tt),L.P.isaddl,L);
+LY.FNy(:,:,tt) =  (LY.Fx(2:end-1,2:end-1,tt) - LY.FA(tt))/(LY.FB(tt) - LY.FA(tt));
+end
+
+
+
+%% Recompute the plasma current as a check. There is a bit of a difference
+psiN = (a.equilibrium.time_slice{tt}.profiles_1d.psi - a.equilibrium.time_slice{tt}.global_quantities.psi_axis)/(a.equilibrium.time_slice{tt}.global_quantities.psi_boundary - a.equilibrium.time_slice{tt}.global_quantities.psi_axis);
+for tt=1:LX.nt
+pprime = a.equilibrium.time_slice{tt}.profiles_1d.dpressure_dpsi;
+p = spline(psiN,pprime);
+pprimey = ppval(p, LY.FNy(:,:,tt));
+pprimey = pprimey.*LY.Opy(:,:,tt);
+
+ttprime = a.equilibrium.time_slice{tt}.profiles_1d.f_df_dpsi;
+T2d2 = cumtrapz(a.equilibrium.time_slice{tt}.profiles_1d.psi,ttprime);
+T2d2 = T2d2 - T2d2(end);
+
+p = spline(psiN,ttprime);
+ttprimey = ppval(p, LY.FNy(:,:,tt));
+ttprimey = ttprimey.*LY.Opy(:,:,tt);
+
+p = spline(psiN,T2d2);
+Ty = ppval(p, LY.FNy(:,:,tt));
+Ty = Ty.*LY.Opy(:,:,tt);
+
+L.rymap = repmat(L.ry',numel(L.zy),1); % Matriz map ry
+LX.Ft(tt) = sum(sum( Ty/LX.rBt(tt)*L.drx*L.dzx./L.rymap ));
+
+Iy = 2*pi*(L.rymap.*pprimey+1./L.rymap.*ttprimey/mu0)*L.drx*L.dzx; % Recomputed plasma current
+
+LY.Ip(tt) = sum(sum(Iy));
+LY.FA(tt) = a.equilibrium.time_slice{tt}.global_quantities.psi_axis;
+LY.FB(tt) = a.equilibrium.time_slice{tt}.global_quantities.psi_boundary;
+LY.Wk(tt) = a.equilibrium.time_slice{tt}.global_quantities.w_mhd;
+LY.PpQ(:,tt) = pprime;
+LY.TTpQ(:,tt) = ttprime;
+LY.psiN(:,tt) = psiN;
+LY.PQ(:,tt) = a.equilibrium.time_slice{tt}.profiles_1d.pressure;
+end
+LY.t = LX.t;
+
+% Put all vector in raw form
+for field = fieldnames(LX).'
+    LX.(field{1}) = v2rw(LX.(field{1}));
+end
+
+% Put all vector in raw form
+for field = fieldnames(LY).'
+    LY.(field{1}) = v2rw(LY.(field{1}));
+end
+
+
+end
+
+
+% Put all vectors in raw form
+function vout = v2rw(vin)
+if numel(size(vin))==2 && sum(ismember(1,size(vin)))==1 && ~ischar(vin)
+   vout = reshape(vin, numel(vin),1);
+else
+    vout = vin;
+end
+end
diff --git a/matlab/IMAS/complete_IDS_CORSICA.m b/matlab/IMAS/complete_IDS_CORSICA.m
new file mode 100644
index 0000000000000000000000000000000000000000..c62e762521d4b56caf4ceac55c993250e745dc47
--- /dev/null
+++ b/matlab/IMAS/complete_IDS_CORSICA.m
@@ -0,0 +1,214 @@
+function IDS_out = complete_IDS_CORSICA(IDS_in,varargin)
+%
+%
+% 
+doread = 0;
+dosave = 0;
+
+if doread
+% $$$   clear all
+% $$$   close all
+% $$$   clc
+
+  % This script will complete the IDS of CORSICA with the missing fields recomputing the missing quantities from available information
+
+  data_path_in = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130510.mat';
+  %path_IDS = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130506.mat';
+  
+  data_path_out = '/NoTivoli/carpanes/LIU_RAP_ITER/CORSICA_ids/CORSICA_130510_extended_COCOS17.mat';
+  
+  % Load the IDS_in file
+  IDS_out = load(data_path_in);
+else
+  IDS_out = IDS_in;
+end
+
+%% Correct COCOS convention on original data
+
+% Put homogenous = 0 on magnetic but 1 on the coils.
+% Sign of the angle of the magnetic probes. 
+
+%% 
+G = G_ITER_generator;
+% Get the structure from generating files
+
+Pliuqe = liupiter(1000,'uuu',ones(G.na,1),'vvv',ones(G.nm,1), 'www', ones(G.nf,1)); % Some default setting that could be removed probably to use the liupiter directly
+G = liug(G,Pliuqe);
+
+L = liuc(Pliuqe,G);
+
+% Extract information from CORSICA IDS_out
+[LC,LXC,LYC] = LLXLY_IDS_corsica(L, IDS_out);
+
+%%  -------------------- ADD the missing information on the existing IDS_out CORSICA -----------------------
+
+%% Consider each circuit to be composed by only one coil
+% TODO NEED TO ADD THE VERTICAL STABILIZATION COIL STILL
+tmp = data_coils();
+for ii = 1:numel(tmp.names)
+    for jj=1:numel(IDS_out.pf_active.coil)
+        % Remove strange character in coil names
+        IDS_out.pf_active.coil{jj}.name = regexprep(IDS_out.pf_active.coil{jj}.name,'[\n\r]+','');
+        if strcmp(tmp.names{ii},IDS_out.pf_active.coil{jj}.name)
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.geometry_type = 2; % Rectangle description
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.r = tmp.R(ii); 
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.z = tmp.Z(ii); 
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.width = tmp.dR(ii);
+            IDS_out.pf_active.coil{jj}.element{1}.geometry.rectangle.height = tmp.dZ(ii);
+            IDS_out.pf_active.coil{jj}.element{1}.turns_with_sign = tmp.N(ii);
+        end
+    end
+end
+
+%% Add the data to the circuit
+Ncoils = numel(IDS_out.pf_active.coil);
+for ii=1:Ncoils-2
+    IDS_out.pf_active.circuit{ii}.name = IDS_out.pf_active.coil{ii}.name;
+    IDS_out.pf_active.supply{ii}.name = IDS_out.pf_active.coil{ii}.name;
+    IDS_out.pf_active.circuit{ii}.current.data = IDS_out.pf_active.coil{ii}.current.data/IDS_out.pf_active.coil{ii}.element{1}.turns_with_sign;
+    IDS_out.pf_active.circuit{ii}.current.time = IDS_out.pf_active.coil{ii}.current.time;
+    IDS_out.pf_active.circuit{ii}.connections = zeros(2, 4*Ncoils);
+    IDS_out.pf_active.circuit{ii}.connections(1, 2*ii) =1;
+    IDS_out.pf_active.circuit{ii}.connections(2, 2*ii-1) = 1;
+    IDS_out.pf_active.circuit{ii}.connections(1, 2*Ncoils + 2*ii-1) =1;
+    IDS_out.pf_active.circuit{ii}.connections(2, 2*Ncoils + 2*ii) =1;
+end
+% Vertical stabilization coil needs to be added still
+for ii=(Ncoils-1):Ncoils
+    IDS_out.pf_active.circuit{ii}.name = IDS_out.pf_active.coil{ii}.name;
+    IDS_out.pf_active.supply{ii}.name = IDS_out.pf_active.coil{ii}.name;
+    IDS_out.pf_active.circuit{ii}.name = IDS_out.pf_active.coil{ii}.name;
+    IDS_out.pf_active.circuit{ii}.current.data = zeros(LXC.nt, 1);
+    IDS_out.pf_active.circuit{ii}.current.time = LXC.t;
+    IDS_out.pf_active.circuit{ii}.connections = zeros(2, 4*Ncoils);
+    IDS_out.pf_active.circuit{ii}.connections(1, 2*ii) =1;
+    IDS_out.pf_active.circuit{ii}.connections(2, 2*ii-1) = 1;
+    IDS_out.pf_active.circuit{ii}.connections(1, 2*Ncoils + 2*ii-1) =1;
+    IDS_out.pf_active.circuit{ii}.connections(2, 2*Ncoils + 2*ii) =1;
+end
+
+%% Limiter description
+tmp = data_limiter();
+IDS_out.wall.description_2d{1}.limiter.unit{1}.outline.r = tmp.r;
+IDS_out.wall.description_2d{1}.limiter.unit{1}.outline.z = tmp.z;
+
+
+%% Vessel description
+% Understand what I need to do for the double layer vessel
+
+%%  -------------- Synthetic diagnostics------------ Need to be recomputed from CORSICA flux map
+
+IDS_out.magnetics.method{1}.ip.time = LXC.t; 
+IDS_out.magnetics.method{1}.ip.data = LXC.Ip;
+
+% Correct IDS magnetics
+magnetics_default = ids_gen('magnetics');
+mag_fluxloop_def_fields = fieldnames(magnetics_default.flux_loop{1});
+if isfield(IDS_out.magnetics,'flux_loop') && length(IDS_out.magnetics.flux_loop) > 0
+  mag_fluxloop_fields = fieldnames(IDS_out.magnetics.flux_loop{1});
+else
+  mag_fluxloop_fields = {};
+end
+fields_to_add = setdiff(mag_fluxloop_def_fields,mag_fluxloop_fields);
+
+%% Ff
+tmp = data_Ff();
+for ii=1:numel(tmp.r)
+  if ~isempty(fields_to_add)
+    for idef=1:length(fields_to_add)
+      % add first defaults and fill in after
+      IDS_out.magnetics.flux_loop{ii}.(fields_to_add{idef}) = magnetics_default.flux_loop{1}.(fields_to_add{idef});
+    end
+    if ii==1; warning(['following fields added to magnetics.flux_loop: ' sprintf('%s ',fields_to_add{:})]); end
+  end
+  IDS_out.magnetics.flux_loop{ii}.position{1}.r = tmp.r(ii);
+  IDS_out.magnetics.flux_loop{ii}.position{1}.z = tmp.z(ii);
+  IDS_out.magnetics.flux_loop{ii}.name = tmp.name{ii};
+end
+
+for ii=1:numel(tmp.r)
+    IDS_out.magnetics.flux_loop{ii}.flux.data = -LXC.Ff(ii,:)';
+    IDS_out.magnetics.flux_loop{ii}.flux.time = LXC.t;
+end
+
+%% Bm
+% Correct IDS magnetics
+magnetics_default = ids_gen('magnetics');
+mag_bpol_probe_def_fields = fieldnames(magnetics_default.bpol_probe{1});
+if isfield(IDS_out.magnetics,'bpol_probe') && length(IDS_out.magnetics.bpol_probe) > 0
+  mag_bpol_probe_fields = fieldnames(IDS_out.magnetics.bpol_probe{1});
+else
+  mag_bpol_probe_fields = {};
+end
+fields_to_add = setdiff(mag_bpol_probe_def_fields,mag_bpol_probe_fields);
+mag_bpol_probe_def_fields = fieldnames(magnetics_default.bpol_probe{1}.position);
+if length(IDS_out.magnetics.bpol_probe) > 0 && isfield(IDS_out.magnetics.bpol_probe{1},'position')
+  mag_bpol_probe_fields = fieldnames(IDS_out.magnetics.bpol_probe{1}.position);
+else
+  mag_bpol_probe_fields = {};
+end
+fields_to_add_position = setdiff(mag_bpol_probe_def_fields,mag_bpol_probe_fields);
+
+tmp = data_Bm();
+for ii=1:numel(tmp.name)
+  if ~isempty(fields_to_add)
+    for idef=1:length(fields_to_add)
+      % add first defaults and fill in after
+      IDS_out.magnetics.bpol_probe{ii}.(fields_to_add{idef}) = magnetics_default.bpol_probe{1}.(fields_to_add{idef});
+    end
+    if ii==1; warning(['following fields added to magnetics.bpol_probe: ' sprintf('%s ',fields_to_add{:})]); end
+  end
+  if ~isempty(fields_to_add_position)
+    for idef=1:length(fields_to_add_position)
+      % add_position first defaults and fill in after
+      IDS_out.magnetics.bpol_probe{ii}.position.(fields_to_add_position{idef}) = magnetics_default.bpol_probe{1}.position.(fields_to_add_position{idef});
+    end
+    if ii==1; warning(['following fields add_positioned to magnetics.bpol_probe.position: ' sprintf('%s ',fields_to_add_position{:})]); end
+  end
+  IDS_out.magnetics.bpol_probe{ii}.position.r = tmp.r(ii);
+  IDS_out.magnetics.bpol_probe{ii}.position.z = tmp.z(ii);
+  IDS_out.magnetics.bpol_probe{ii}.poloidal_angle = -tmp.am(ii); % Correct the sign to be consistent with COCOS 11
+  IDS_out.magnetics.bpol_probe{ii}.name = tmp.name{ii};
+end
+
+for ii=1:numel(tmp.name)
+    IDS_out.magnetics.bpol_probe{ii}.field.data = LXC.Bm(ii,:)';
+    IDS_out.magnetics.bpol_probe{ii}.field.time = LXC.t;
+end
+
+%% Ft 
+mag_method_def_fields = fieldnames(magnetics_default.method{1});
+if isfield(IDS_out.magnetics,'method') && length(IDS_out.magnetics.method) > 0
+  mag_method_fields = fieldnames(IDS_out.magnetics.method{1});
+else
+  mag_method_fields = {};
+end
+fields_to_add = setdiff(mag_method_def_fields,mag_method_fields);
+if ~isempty(fields_to_add)
+  for idef=1:length(fields_to_add)
+    % add first defaults and fill in after
+    IDS_out.magnetics.method{1}.(fields_to_add{idef}) = magnetics_default.method{1}.(fields_to_add{idef});
+  end
+  warning(['following fields added to magnetics.method: ' sprintf('%s ',fields_to_add{:})]);
+end
+IDS_out.magnetics.method{1}.diamagnetic_flux.data = -LXC.Ft;
+IDS_out.magnetics.method{1}.diamagnetic_flux.time = LXC.t;
+
+%% rBt
+%IDS_out.tf.time = LXC.t;
+IDS_out.tf.b_field_tor_vacuum_r.time  = LXC.t;
+IDS_out.tf.b_field_tor_vacuum_r.data  = LXC.rBt;
+
+%% Convert from cocos_in to cocos_out
+cocos_in = 17;
+cocos_out = 11;
+to_transform = {'pf_active','pf_passive','magnetics','tf','wall','equilibrium'};
+for i=1:length(to_transform)
+  IDS_out.(to_transform{i}) = ids_generic_cocos_nodes_transformation_symbolic(IDS_out.(to_transform{i}), to_transform{i}, cocos_in, cocos_out,[],[],[],[],[],3);
+end
+
+%% Store the resulting data
+if dosave
+  save(data_path_out, '-struct', 'IDS_out')
+  fprintf('\n wrote file %s \n', data_path_out);
+end
diff --git a/matlab/IMAS/data_Bm.m b/matlab/IMAS/data_Bm.m
new file mode 100644
index 0000000000000000000000000000000000000000..0e84c89a7975d4665c4b449e8409b1fd5575d289
--- /dev/null
+++ b/matlab/IMAS/data_Bm.m
@@ -0,0 +1,645 @@
+function data_struct = data_Bm()
+% Data coming from CREATE for the moment
+
+
+R = [ ...
+ 3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2148
+    3.2354
+    3.3715
+    3.6254
+    3.9788
+    4.4073
+    4.8813
+    5.3703
+    5.8554
+    6.3180
+    6.7576
+    7.1771
+    7.5733
+    7.9435
+    8.2849
+    8.5950
+    8.8716
+    9.1129
+    9.3166
+    9.4815
+    9.6064
+    9.6891
+    9.7128
+    9.6724
+    9.5687
+    9.4033
+    9.2053
+    9.0072
+    8.8092
+    8.6111
+    8.4131
+    8.2150
+    7.9944
+    7.7107
+    7.3694
+    6.9785
+    6.5471
+    6.0853
+    5.6039
+    5.1140
+    4.6588
+    4.2045
+    3.8101
+    3.5012
+    3.2986
+    3.2163
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2529
+    3.3883
+    3.6410
+    3.9931
+    4.4202
+    4.8929
+    5.3808
+    5.8651
+    6.3270
+    6.7660
+    7.1850
+    7.5808
+    7.9507
+    8.2917
+    8.6016
+    8.8780
+    9.1191
+    9.3227
+    9.4875
+    9.6123
+    9.6949
+    9.7186
+    9.6783
+    9.5746
+    9.4093
+    9.2114
+    9.0135
+    8.8156
+    8.6177
+    8.4198
+    8.2219
+    8.0015
+    7.7180
+    7.3770
+    6.9866
+    6.5557
+    6.0946
+    5.6140
+    5.1251
+    4.6710
+    4.2180
+    3.8249
+    3.5174
+    3.3157
+    3.2339
+    3.6049
+    3.6049
+    3.6049
+    3.6049
+    3.6049
+    3.6049
+    3.6945
+    4.3808
+    5.4128
+    6.5315
+    7.1712
+    8.0290
+    8.4989
+    8.8528
+    8.8902
+    8.4899
+    8.0776
+    7.0513
+    6.6154
+    5.8379
+    5.0321
+    4.2683
+    3.7569
+    3.6138
+    3.6197
+    3.7624
+    4.2717
+    5.0325
+    5.8362
+    6.6118
+    7.1432
+    6.2599
+    5.4564
+    4.4007
+    3.6987
+    3.6069
+    5.8728
+    5.8728
+    5.8728
+    5.8728
+    5.1255
+    5.0954
+    4.8932
+    4.8373
+    4.6319
+    4.5798
+    4.1091
+    4.1247
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.3856
+    4.4089
+    5.8551
+    7.1768
+    8.2848
+    9.1128
+    9.6065
+    9.6733
+    9.2068
+    8.6126
+    8.0097
+    7.0033
+    5.6333
+    4.2076
+    3.3143
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.2324
+    3.3856
+    4.4089
+    5.8551
+    7.1768
+    8.2848
+    9.1128
+    9.6065
+    9.6733
+    9.2068
+    8.6126
+    8.0097
+    7.0033
+    5.6333
+    4.2076
+    3.3143];
+
+Z = [ ...
+    -3.3135
+   -2.8228
+   -2.3321
+   -1.8415
+   -1.3508
+   -0.8601
+   -0.3695
+    0.1212
+    0.6119
+    1.1025
+    1.5932
+    2.0839
+    2.5745
+    3.0652
+    3.5559
+    4.0481
+    4.5225
+    4.9450
+    5.2872
+    5.5269
+    5.6513
+    5.6799
+    5.6121
+    5.4508
+    5.2332
+    4.9790
+    4.6899
+    4.3680
+    4.0158
+    3.6358
+    3.2307
+    2.8028
+    2.3565
+    1.8946
+    1.4202
+    0.9368
+    0.4470
+   -0.0416
+   -0.5208
+   -0.9824
+   -1.4314
+   -1.8803
+   -2.3292
+   -2.7781
+   -3.2270
+   -3.6760
+   -4.1138
+   -4.5135
+   -4.8653
+   -5.1611
+   -5.3939
+   -5.5583
+   -5.6504
+   -5.6682
+   -5.6030
+   -5.4179
+   -5.1247
+   -4.7413
+   -4.2916
+   -3.8048
+   -3.3135
+   -2.8228
+   -2.3321
+   -1.8415
+   -1.3508
+   -0.8601
+   -0.3695
+    0.1212
+    0.6119
+    1.1025
+    1.5932
+    2.0839
+    2.5745
+    3.0652
+    3.5559
+    4.0481
+    4.5225
+    4.9450
+    5.2872
+    5.5269
+    5.6513
+    5.6799
+    5.6121
+    5.4508
+    5.2332
+    4.9790
+    4.6899
+    4.3680
+    4.0158
+    3.6358
+    3.2307
+    2.8028
+    2.3565
+    1.8946
+    1.4202
+    0.9368
+    0.4470
+   -0.0416
+   -0.5208
+   -0.9824
+   -1.4314
+   -1.8803
+   -2.3292
+   -2.7781
+   -3.2270
+   -3.6760
+   -4.1138
+   -4.5135
+   -4.8653
+   -5.1611
+   -5.3939
+   -5.5583
+   -5.6504
+   -5.6682
+   -5.6030
+   -5.4179
+   -5.1247
+   -4.7413
+   -4.2916
+   -3.8048
+   -1.9526
+   -0.9263
+    0.1002
+    1.1115
+    2.1279
+    3.1543
+    4.0833
+    4.9130
+    5.1064
+    4.5191
+    4.0554
+    3.1463
+    2.3613
+    1.3248
+   -0.0607
+   -1.1854
+   -2.0866
+   -2.9331
+   -4.5751
+   -4.9694
+   -5.0680
+   -4.7946
+   -4.1890
+   -3.6519
+   -3.6514
+   -4.1865
+   -4.7896
+   -5.0620
+   -4.9636
+   -4.5703
+    4.0706
+    4.6994
+    5.0927
+    4.9176
+    4.0710
+    2.6386
+   -3.8984
+   -3.9322
+   -4.1237
+   -4.1575
+   -4.2458
+   -4.1938
+   -3.9825
+   -3.9604
+   -3.9736
+   -4.0036
+   -3.3109
+   -3.2809
+   -2.8228
+   -1.3508
+    0.1212
+    1.5932
+    3.0652
+    4.5164
+    5.5223
+    5.6124
+    4.9798
+    4.0170
+    2.8048
+    1.4224
+   -0.0394
+   -1.4293
+   -2.7761
+   -4.0891
+   -5.1455
+   -5.6471
+   -5.4120
+   -4.2868
+   -2.8228
+   -1.3508
+    0.1212
+    1.5932
+    3.0652
+    4.5164
+    5.5223
+    5.6124
+    4.9798
+    4.0170
+    2.8048
+    1.4224
+   -0.0394
+   -1.4293
+   -2.7761
+   -4.0891
+   -5.1455
+   -5.6471
+   -5.4120
+   -4.2868];
+
+
+am = [...
+    -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.7174
+   -1.9757
+   -2.2358
+   -2.4941
+   -2.7541
+   -2.9863
+    3.1015
+    2.9042
+    2.7245
+    2.6389
+    2.5534
+    2.4679
+    2.3841
+    2.2986
+    2.2131
+    2.1276
+    2.0420
+    1.9565
+    1.8710
+    1.7855
+    1.6842
+    1.5533
+    1.4224
+    1.2915
+    1.1606
+    1.1554
+    1.1554
+    1.1554
+    1.1554
+    1.1554
+    1.1554
+    1.0297
+    0.8762
+    0.7243
+    0.5707
+    0.4189
+    0.2653
+    0.1117
+   -0.0401
+   -0.2670
+   -0.5201
+   -0.7732
+   -1.0263
+   -1.2793
+   -1.5324
+    3.1416
+    3.1416
+   -3.1416
+    3.1416
+   -3.1416
+    3.1416
+    3.1416
+   -3.1416
+   -3.1416
+    3.1416
+   -3.1416
+    3.1416
+   -3.1416
+   -3.1416
+   -3.1416
+    2.9950
+    2.7332
+    2.4714
+    2.2113
+    1.9530
+    1.7261
+    1.5307
+    1.3334
+    1.1537
+    1.0681
+    0.9844
+    0.8988
+    0.8133
+    0.7278
+    0.6423
+    0.5568
+    0.4712
+    0.3857
+    0.3002
+    0.2147
+    0.1134
+   -0.0175
+   -0.1484
+   -0.2793
+   -0.4102
+   -0.4154
+   -0.4154
+   -0.4154
+   -0.4154
+   -0.4154
+   -0.4154
+   -0.5411
+   -0.6946
+   -0.8465
+   -1.0001
+   -1.1537
+   -1.3055
+   -1.4591
+   -1.6109
+   -1.8326
+   -2.0857
+   -2.3387
+   -2.5936
+   -2.8466
+   -3.1032
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.9076
+   -2.6128
+    2.9828
+    2.5377
+    2.4522
+    2.2026
+    2.0193
+    1.7523
+    1.4591
+    1.1414
+    1.1414
+    0.6597
+    0.6475
+    0.2915
+   -0.0785
+   -0.6091
+   -1.1292
+   -1.4923
+    0.0785
+    0.4416
+    0.9617
+    1.4923
+    1.8623
+    2.2183
+   -2.2532
+   -2.1747
+   -1.7593
+   -1.0542
+   -0.3299
+         0
+    2.3562
+   -2.3562
+    2.3562
+   -2.3562
+   -1.0472
+    0.5236
+   -0.3752
+    1.1956
+    0.5236
+    2.0944
+   -1.2671
+    0.3037
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.5708
+   -1.9757
+   -2.7541
+    2.9042
+    2.5552
+    2.2986
+    2.0420
+    1.7855
+    1.4242
+    1.1554
+    1.1554
+    1.0385
+    0.5794
+    0.1222
+   -0.5201
+   -1.2793
+   -3.1416
+   -3.1416
+   -3.1416
+   -3.1416
+   -3.1416
+    2.7367
+    1.9583
+    1.3334
+    0.9844
+    0.7278
+    0.4712
+    0.2147
+   -0.1466
+   -0.4154
+   -0.4154
+   -0.5323
+   -0.9913
+   -1.4486
+   -2.0909
+   -2.8501];
+
+data_struct = struct();
+data_struct.r = R;
+data_struct.z = Z;
+data_struct.am = am; 
+nm = numel(R);
+for ii=1:nm
+   data_struct.name{ii}= num2str(ii); 
+end
+
+end
diff --git a/matlab/IMAS/data_Ff.m b/matlab/IMAS/data_Ff.m
new file mode 100644
index 0000000000000000000000000000000000000000..3e3cd7b0b68741cf18e8090bac60f4f20d6bdb78
--- /dev/null
+++ b/matlab/IMAS/data_Ff.m
@@ -0,0 +1,132 @@
+function data_struct = data_Ff()
+% Data from CREATE 
+
+r = [ ...
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5719
+    3.5718
+    3.5719
+    3.5719
+    3.9189
+    3.5719
+    4.7127
+    3.9270
+    5.8297
+    4.7667
+    7.2587
+    5.8678
+    7.8500
+    7.2704
+    8.3606
+    7.8667
+    8.7525
+    8.3720
+    8.9547
+    8.7661
+    8.8028
+    8.9548
+    7.9482
+    8.7870
+    6.7906
+    7.8494
+    6.5232
+    7.6253
+    4.8568
+    6.5142
+    3.9137
+    4.8465
+    3.5719
+    3.9058
+    3.5719
+    3.5719
+    4.7870
+    6.4120
+    8.5040
+    9.3800
+    9.3050
+    5.2270
+    3.5670
+    3.5670
+    8.7470
+    8.7660
+    3.5670
+    5.8470
+    8.3550
+    7.8710];
+
+z = [...
+   -1.6552
+   -2.5535
+   -0.5357
+   -1.6492
+    0.4707
+   -0.5257
+    1.3969
+    0.4807
+    2.4113
+    1.4570
+    3.5348
+    2.4173
+    4.5612
+    3.5649
+    5.0969
+    4.5712
+    5.0188
+    5.1120
+    4.0305
+    5.0008
+    3.4347
+    4.0205
+    2.7037
+    3.4147
+    1.8425
+    2.6837
+    0.5608
+    1.8025
+   -0.5808
+    0.5548
+   -2.4583
+   -0.6208
+   -3.2580
+   -2.6262
+   -4.6864
+   -3.1643
+   -5.0819
+   -4.6924
+   -4.5111
+   -5.0799
+   -3.5248
+   -4.5011
+   -2.6236
+   -3.4797
+    5.6270
+    5.4040
+    3.7560
+    2.2060
+   -1.2180
+   -5.6640
+   -3.4900
+    1.4350
+    1.8200
+   -0.6420
+   -2.6100
+    5.0000
+    2.6900
+   -2.6000];
+
+data_struct = struct();
+data_struct.r = r;
+data_struct.z = z;
+nf = numel(z);
+for ii=1:nf
+   data_struct.name{ii} = num2str(ii); 
+end
+
+end
diff --git a/matlab/IMAS/data_coils.m b/matlab/IMAS/data_coils.m
new file mode 100644
index 0000000000000000000000000000000000000000..28fe720a2cdf1e05eabea725d73a4a486232d9ce
--- /dev/null
+++ b/matlab/IMAS/data_coils.m
@@ -0,0 +1,27 @@
+function [data_struct] = data_coils()
+% Data BASED on ITER_D_24JQWZ V1.0
+% VSU and VSL are not correctly described at the moment
+
+names = {'CS3U';'CS2U';'CS1U';'CS1L';'CS2L';'CS3L';'PF1';...
+        'PF2';'PF3';'PF4';'PF5';'PF6'; 'VSU'; 'VSL'};
+
+R = [1.6870 ; 1.6870; 1.6870; 1.6870; 1.6870; ...
+    1.6870; 3.9431; 8.2851; 11.9919; 11.9630; 8.3908; 4.3340; 5.8261;7.5222];
+Z = [ 5.4640; 3.2780; 1.0920; -1.0720; -3.2580; -5.4440;...
+    7.5741; 6.5398; 3.2752; -2.2336; -6.7269; -7.4665; 4.9249;-2.4912];
+dR = [0.7400; 0.7400;0.7400;0.7400;0.7400;0.7400;0.9590;0.5801;0.6963;0.6382;0.8125;1.5590;0.132;0.132];
+dZ = [2.0930; 2.093; 2.093; 2.093; 2.093; 2.093; 0.9841; 0.7146; 0.9538; 0.9538; 0.9538; 1.1075; 0.132;0.132];
+
+N = [554;554;554;554;554;554;248.6;115.2;185.9;169.9;216.8;459.4; 4; 4];
+
+N = round(N);
+
+data_struct = struct();
+data_struct.R = R;
+data_struct.Z = Z;
+data_struct.dR = dR;
+data_struct.dZ = dZ;
+data_struct.N = N;
+data_struct.names = names; 
+
+end
diff --git a/matlab/IMAS/data_limiter.m b/matlab/IMAS/data_limiter.m
new file mode 100644
index 0000000000000000000000000000000000000000..25c05615178e26d33dbd5c6b5314931b9d288fc2
--- /dev/null
+++ b/matlab/IMAS/data_limiter.m
@@ -0,0 +1,642 @@
+function data_struct = data_limiter()
+% Data from 
+%Plasma facing line of First Wall and Divertor					
+%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]					
+
+R = [...
+    4.1761
+    4.1742
+    4.1932
+    4.2122
+    4.2369
+    4.2615
+    4.2936
+    4.3257
+    4.3507
+    4.3757
+    4.4083
+    4.4408
+    4.4551
+    4.4694
+    4.4880
+    4.5066
+    4.5111
+    4.5157
+    4.5019
+    4.4882
+    4.4776
+    4.4670
+    4.4499
+    4.4327
+    4.4196
+    4.4064
+    4.3918
+    4.3773
+    4.3630
+    4.3487
+    4.3301
+    4.3115
+    4.2950
+    4.2786
+    4.2622
+    4.2457
+    4.2128
+    4.1799
+    4.2431
+    4.3063
+    4.3575
+    4.4088
+    4.4503
+    4.4918
+    4.5302
+    4.5687
+    4.6071
+    4.6456
+    4.6838
+    4.7221
+    4.7718
+    4.8215
+    4.9099
+    4.9982
+    5.0311
+    5.0640
+    5.1068
+    5.1496
+    5.2012
+    5.2529
+    5.2579
+    5.2628
+    5.2678
+    5.2727
+    5.3080
+    5.3433
+    5.3892
+    5.4351
+    5.5000
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5650
+    5.5685
+    5.5720
+    5.5720
+    5.5720
+    5.5783
+    5.5845
+    5.5927
+    5.6008
+    5.6216
+    5.6425
+    5.6633
+    5.6842
+    5.7496
+    5.8150
+    5.8517
+    5.8883
+    5.9352
+    5.9821
+    6.0766
+    6.1710
+    6.2190
+    6.2670
+    6.3220
+    6.3771
+    6.4487
+    6.5202
+    6.5667
+    6.6133
+    6.6598
+    6.7063
+    6.7575
+    6.8087
+    6.8599
+    6.9111
+    6.9898
+    7.0686
+    7.1292
+    7.1898
+    7.2364
+    7.2830
+    7.3126
+    7.3422
+    7.3807
+    7.4191
+    7.4692
+    7.5192
+    7.5842
+    7.6492
+    7.7198
+    7.7904
+    7.8447
+    7.8990
+    7.9434
+    7.9878
+    8.0167
+    8.0456
+    8.0745
+    8.1033
+    8.1320
+    8.1606
+    8.1892
+    8.2179
+    8.2399
+    8.2619
+    8.2840
+    8.3060
+    8.3117
+    8.3173
+    8.3247
+    8.3321
+    8.3417
+    8.3513
+    8.3575
+    8.3636
+    8.3698
+    8.3760
+    8.3855
+    8.3950
+    8.3819
+    8.3688
+    8.3602
+    8.3517
+    8.3432
+    8.3346
+    8.3209
+    8.3073
+    8.2967
+    8.2862
+    8.2781
+    8.2700
+    8.2304
+    8.1907
+    8.1649
+    8.1392
+    8.1134
+    8.0876
+    8.0617
+    8.0357
+    8.0098
+    7.9838
+    7.9439
+    7.9040
+    7.8498
+    7.7956
+    7.7251
+    7.6546
+    7.5827
+    7.5107
+    7.4554
+    7.4000
+    7.3470
+    7.2940
+    7.2251
+    7.1561
+    7.0666
+    6.9770
+    6.9219
+    6.8668
+    6.8117
+    6.7566
+    6.6718
+    6.5870
+    6.5119
+    6.4368
+    6.3392
+    6.2416
+    6.1899
+    6.1381
+    6.0864
+    6.0347
+    5.9551
+    5.8755
+    5.8142
+    5.7530
+    5.6964
+    5.6398
+    5.5662
+    5.4927
+    5.3970
+    5.3014
+    5.1891
+    5.0768
+    4.9904
+    4.9040
+    4.8370
+    4.7699
+    4.6827
+    4.5956
+    4.5152
+    4.4347
+    4.3729
+    4.3110
+    4.2884
+    4.2659
+    4.2366
+    4.2072
+    4.1843
+    4.1613
+    4.1437
+    4.1260
+    4.1208
+    4.1156
+    4.1123
+    4.1089
+    4.1055
+    4.1022
+    4.0966
+    4.0911
+    4.0868
+    4.0826
+    4.0793
+    4.0760
+    4.0742
+    4.0724
+    4.0700
+    4.0676
+    4.0645
+    4.0615
+    4.0582
+    4.0549
+    4.0524
+    4.0499
+    4.0479
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0460
+    4.0474
+    4.0487
+    4.0505
+    4.0523
+    4.0546
+    4.0570
+    4.0584
+    4.0598
+    4.0612
+    4.0626
+    4.0648
+    4.0670
+    4.0690
+    4.0709
+    4.0735
+    4.0761
+    4.0794
+    4.0827
+    4.0848
+    4.0868
+    4.0888
+    4.0908
+    4.0939
+    4.0970
+    4.1061
+    4.1153
+    4.1228
+    4.1303
+    4.1365
+    4.1426
+    4.1477
+    4.1527
+    4.1569
+    4.1610
+    4.1644
+    4.1678
+    4.1706
+    4.1734
+    4.1757
+    4.1780];
+
+Z = [...
+    -2.5367
+   -2.5674
+   -2.5779
+   -2.5885
+   -2.6021
+   -2.6158
+   -2.6336
+   -2.6514
+   -2.6795
+   -2.7077
+   -2.7442
+   -2.7808
+   -2.8156
+   -2.8505
+   -2.8957
+   -2.9410
+   -3.0274
+   -3.1139
+   -3.1609
+   -3.2078
+   -3.2440
+   -3.2801
+   -3.3152
+   -3.3503
+   -3.3773
+   -3.4043
+   -3.4421
+   -3.4799
+   -3.5092
+   -3.5386
+   -3.5767
+   -3.6148
+   -3.6485
+   -3.6822
+   -3.7160
+   -3.7497
+   -3.8172
+   -3.8847
+   -3.8897
+   -3.8946
+   -3.8987
+   -3.9027
+   -3.9059
+   -3.9092
+   -3.8684
+   -3.8276
+   -3.7868
+   -3.7460
+   -3.7380
+   -3.7299
+   -3.7195
+   -3.7090
+   -3.7252
+   -3.7414
+   -3.7624
+   -3.7835
+   -3.8108
+   -3.8382
+   -3.9117
+   -3.9852
+   -4.0548
+   -4.1244
+   -4.1940
+   -4.2636
+   -4.2989
+   -4.3342
+   -4.3801
+   -4.4260
+   -4.4909
+   -4.5559
+   -4.4793
+   -4.4026
+   -4.3260
+   -4.2494
+   -4.2061
+   -4.1628
+   -4.1295
+   -4.0962
+   -4.0461
+   -3.9961
+   -3.9461
+   -3.8960
+   -3.8539
+   -3.8118
+   -3.7571
+   -3.7024
+   -3.6584
+   -3.6145
+   -3.5705
+   -3.5265
+   -3.4544
+   -3.3823
+   -3.3603
+   -3.3384
+   -3.3103
+   -3.2822
+   -3.2586
+   -3.2350
+   -3.1405
+   -3.0460
+   -3.0033
+   -2.9605
+   -2.9049
+   -2.8494
+   -2.8132
+   -2.7771
+   -2.7410
+   -2.7049
+   -2.6651
+   -2.6253
+   -2.5856
+   -2.5458
+   -2.4847
+   -2.4235
+   -2.3764
+   -2.3294
+   -2.2932
+   -2.2570
+   -2.2130
+   -2.1691
+   -2.1119
+   -2.0548
+   -1.9805
+   -1.9062
+   -1.8096
+   -1.7130
+   -1.6082
+   -1.5033
+   -1.4227
+   -1.3420
+   -1.2415
+   -1.1410
+   -1.0756
+   -1.0103
+   -0.9449
+   -0.8796
+   -0.8148
+   -0.7500
+   -0.6852
+   -0.6204
+   -0.5705
+   -0.5207
+   -0.4708
+   -0.4210
+   -0.3538
+   -0.2866
+   -0.1992
+   -0.1119
+    0.0017
+    0.1153
+    0.1884
+    0.2616
+    0.3348
+    0.4079
+    0.5205
+    0.6330
+    0.7430
+    0.8530
+    0.9245
+    0.9961
+    1.0676
+    1.1391
+    1.2538
+    1.3686
+    1.4569
+    1.5452
+    1.6131
+    1.6810
+    1.7658
+    1.8506
+    1.9057
+    1.9609
+    2.0160
+    2.0711
+    2.1266
+    2.1821
+    2.2377
+    2.2932
+    2.3786
+    2.4640
+    2.5409
+    2.6178
+    2.7178
+    2.8177
+    2.9198
+    3.0219
+    3.1005
+    3.1790
+    3.2256
+    3.2722
+    3.3329
+    3.3935
+    3.4722
+    3.5510
+    3.5995
+    3.6480
+    3.6964
+    3.7449
+    3.8194
+    3.8940
+    3.9514
+    4.0089
+    4.0835
+    4.1582
+    4.1978
+    4.2374
+    4.2770
+    4.3165
+    4.3774
+    4.4383
+    4.4852
+    4.5320
+    4.5440
+    4.5560
+    4.5716
+    4.5872
+    4.6075
+    4.6278
+    4.6516
+    4.6754
+    4.6937
+    4.7120
+    4.6681
+    4.6243
+    4.5672
+    4.5102
+    4.4576
+    4.4050
+    4.3645
+    4.3240
+    4.2335
+    4.1430
+    4.0254
+    3.9078
+    3.8157
+    3.7236
+    3.6528
+    3.5820
+    3.4768
+    3.3715
+    3.3031
+    3.2347
+    3.1663
+    3.0979
+    2.9853
+    2.8726
+    2.7860
+    2.6993
+    2.6327
+    2.5660
+    2.5042
+    2.4425
+    2.3622
+    2.2819
+    2.1775
+    2.0731
+    1.9621
+    1.8511
+    1.7657
+    1.6804
+    1.6147
+    1.5490
+    1.4854
+    1.4218
+    1.3391
+    1.2564
+    1.1489
+    1.0414
+    0.9337
+    0.8261
+    0.7432
+    0.6604
+    0.5967
+    0.5330
+    0.4665
+    0.4000
+    0.3135
+    0.2271
+    0.1147
+    0.0023
+   -0.0664
+   -0.1352
+   -0.2039
+   -0.2726
+   -0.3783
+   -0.4840
+   -0.5508
+   -0.6177
+   -0.7045
+   -0.7914
+   -0.9043
+   -1.0173
+   -1.0855
+   -1.1537
+   -1.2219
+   -1.2901
+   -1.3951
+   -1.5000
+   -1.6135
+   -1.7271
+   -1.8203
+   -1.9135
+   -1.9900
+   -2.0665
+   -2.1292
+   -2.1920
+   -2.2435
+   -2.2951
+   -2.3373
+   -2.3796
+   -2.4143
+   -2.4490
+   -2.4775
+   -2.5060];
+
+data_struct = struct();
+data_struct.r = R;
+data_struct.z  = Z;
+
+end
diff --git a/matlab/IMAS/data_rW.m b/matlab/IMAS/data_rW.m
new file mode 100644
index 0000000000000000000000000000000000000000..4bd0ccb73b8b9155accba40328bcb825152a4aab
--- /dev/null
+++ b/matlab/IMAS/data_rW.m
@@ -0,0 +1,118 @@
+function data_struct = data_rW()
+% Data from CREATE
+
+r = [...
+4.4155
+    5.6389
+    8.3950
+    7.4708
+    5.7629
+    4.0460
+    4.0970
+    4.0670
+    4.0460
+    4.0460
+    4.0760
+    4.1254
+    4.3159
+    4.9131
+    5.7602
+    5.7629
+    6.5925
+    7.4708
+    7.9349
+    8.2703
+    8.3950
+    8.3062
+    7.9008
+    7.2865
+    6.2723];
+
+z = [...
+    -3.4043
+   -3.8511
+    0.6328
+    3.0785
+    4.5244
+    0.5328
+   -1.5000
+   -0.4836
+    0.5328
+    1.5492
+    2.5656
+    3.5697
+    4.3272
+    4.7101
+    4.5265
+    4.5244
+    3.8891
+    3.0785
+    2.3978
+    1.6788
+    0.6328
+   -0.4191
+   -1.3379
+   -2.2518
+   -3.0419];
+
+aW = [...
+0.5000
+    0.4000
+    2.0000
+    1.9999
+    3.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    3.0000
+    3.0000
+    3.0000
+    3.0000
+    3.0000
+    3.0000
+    1.9999
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000
+    2.0000];
+
+oW = [...
+    -3.4043
+   -3.8511
+    0.6328
+    3.0785
+    4.5244
+    0.5328
+   -1.5000
+   -0.4836
+    0.5328
+    1.5492
+    2.5656
+    3.5697
+    4.3272
+    4.7101
+    4.5265
+    4.5244
+    3.8891
+    3.0785
+    2.3978
+    1.6788
+    0.6328
+   -0.4191
+   -1.3379
+   -2.2518
+   -3.0419];
+
+data_struct = struct();
+data_struct.r = r;
+data_struct.z = z;
+data_struct.oW = oW;
+data_struct.aW = aW;
+
+end
diff --git a/matlab/IMAS/data_vessel.m b/matlab/IMAS/data_vessel.m
new file mode 100644
index 0000000000000000000000000000000000000000..d2ebe7f592f82567db19690d8486217b87fee47f
--- /dev/null
+++ b/matlab/IMAS/data_vessel.m
@@ -0,0 +1,637 @@
+function vessel_data = data_vessel()
+% Plasma facing line of First Wall and Divertor					
+%Reference: [2N9J75, v.1.7], [PCR 641, PS4HQW]					
+
+
+rin = [ ...
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5514
+3.5869
+3.6453
+3.7260
+3.8276
+3.9489
+4.0878
+4.2425
+4.4107
+4.5899
+4.7775
+4.9708
+5.1670
+5.3631
+5.5564
+5.7440
+5.9232
+6.0913
+6.2474
+6.4034
+6.5595
+6.7156
+6.8716
+7.0315
+7.1867
+7.3371
+7.4825
+7.6226
+7.7572
+7.8861
+8.0092
+8.1262
+8.2370
+8.3413
+8.4391
+8.5302
+8.6145
+8.6918
+8.7619
+8.8249
+8.8764
+8.9166
+8.9453
+8.9638
+8.9768
+8.9844
+8.9865
+8.9832
+8.9744
+8.9602
+8.9364
+8.8985
+8.8468
+8.7817
+8.7023
+8.6228
+8.5433
+8.4638
+8.3844
+8.3049
+8.2254
+8.1459
+8.0665
+7.9870
+7.9075
+7.8280
+7.7486
+7.6691
+7.5896
+7.5102
+7.4307
+7.3458
+7.2486
+7.1396
+7.0195
+6.8888
+6.7483
+6.5988
+6.4411
+6.2762
+6.1048
+5.9281
+5.7469
+5.5623
+5.3753
+5.1869
+4.9897
+4.7949
+4.6054
+4.4242
+4.2538
+4.0969
+3.9558
+3.8327
+3.7293
+3.6472
+3.5877
+3.5516
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396
+3.5396];
+
+zin = [ ...
+    0.0307
+0.2278
+0.4250
+0.6221
+0.8192
+1.0164
+1.2135
+1.4106
+1.6078
+1.8049
+2.0020
+2.1992
+2.3963
+2.5935
+2.7906
+2.9877
+3.1849
+3.3820
+3.5791
+3.7753
+3.9686
+4.1562
+4.3354
+4.5035
+4.6582
+4.7971
+4.9183
+5.0200
+5.1006
+5.1590
+5.1944
+5.2062
+5.1943
+5.1589
+5.1004
+5.0197
+4.9180
+4.8102
+4.7024
+4.5946
+4.4868
+4.3790
+4.2640
+4.1429
+4.0158
+3.8830
+3.7446
+3.6009
+3.4521
+3.2984
+3.1400
+2.9772
+2.8102
+2.6393
+2.4647
+2.2867
+2.1056
+1.9216
+1.7351
+1.5529
+1.3679
+1.1809
+1.0073
+0.8333
+0.6590
+0.4845
+0.3100
+0.1357
+-0.0382
+-0.2088
+-0.3768
+-0.5411
+-0.7006
+-0.8743
+-1.0480
+-1.2217
+-1.3954
+-1.5691
+-1.7428
+-1.9166
+-2.0903
+-2.2640
+-2.4377
+-2.6114
+-2.7851
+-2.9588
+-3.1325
+-3.3062
+-3.4799
+-3.6536
+-3.8222
+-3.9840
+-4.1380
+-4.2835
+-4.4196
+-4.5456
+-4.6608
+-4.7645
+-4.8561
+-4.9352
+-5.0013
+-5.0540
+-5.0931
+-5.1183
+-5.1295
+-5.1217
+-5.0899
+-5.0345
+-4.9564
+-4.8567
+-4.7369
+-4.5989
+-4.4446
+-4.2765
+-4.0970
+-3.9088
+-3.7148
+-3.5178
+-3.3206
+-3.1235
+-2.9264
+-2.7292
+-2.5321
+-2.3349
+-2.1378
+-1.9407
+-1.7435
+-1.5464
+-1.3493
+-1.1521
+-0.9550
+-0.7579
+-0.5607
+-0.3636
+-0.1665];
+
+rout=[...
+6.2270
+6.4090
+6.5880
+6.7639
+6.9365
+7.1054
+7.2706
+7.4318
+7.5888
+7.7414
+7.8895
+8.0328
+8.1712
+8.3046
+8.4327
+8.5554
+8.6726
+8.7840
+8.8897
+8.9894
+9.0830
+9.1705
+9.2516
+9.3264
+9.3946
+9.4563
+9.5114
+9.5598
+9.6014
+9.6361
+9.6616
+9.6771
+9.6825
+9.6777
+9.6629
+9.6380
+9.6031
+9.5583
+9.5038
+9.4396
+9.3660
+9.2900
+9.2141
+9.1382
+9.0623
+8.9863
+8.9104
+8.8345
+8.7585
+8.6826
+8.6067
+8.5308
+8.4548
+8.3789
+8.3030
+8.2270
+8.1511
+8.0681
+7.9748
+7.8714
+7.7584
+7.6362
+7.5052
+7.3659
+7.2188
+7.0645
+6.9035
+6.7364
+6.5638
+6.3864
+6.2048
+6.0196
+5.8317
+5.6415
+5.4499
+5.2575
+5.0651
+4.8734
+4.6848
+4.5011
+4.3243
+4.1561
+3.9982
+3.8523
+3.7199
+3.6022
+3.5005
+3.4159
+3.3492
+3.3010
+3.2719
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2622
+3.2717
+3.3002
+3.3473
+3.4126
+3.4953
+3.5948
+3.7098
+3.8394
+3.9820
+4.1364
+4.3008
+4.4737
+4.6532
+4.8274
+5.0040
+5.1820
+5.3605
+5.5385
+5.7151
+5.8894
+6.0603];
+
+
+zout=[...
+    5.4684
+5.3873
+5.3000
+5.2064
+5.1067
+5.0011
+4.8897
+4.7726
+4.6499
+4.5218
+4.3885
+4.2501
+4.1068
+3.9588
+3.8062
+3.6492
+3.4881
+3.3229
+3.1540
+2.9815
+2.8056
+2.6266
+2.4447
+2.2600
+2.0728
+1.8833
+1.6919
+1.4986
+1.3037
+1.1076
+0.9153
+0.7220
+0.5282
+0.3343
+0.1410
+-0.0513
+-0.2421
+-0.4308
+-0.6169
+-0.7999
+-0.9793
+-1.1514
+-1.3235
+-1.4956
+-1.6677
+-1.8398
+-2.0119
+-2.1840
+-2.3561
+-2.5282
+-2.7003
+-2.8724
+-3.0445
+-3.2166
+-3.3887
+-3.5608
+-3.7329
+-3.9066
+-4.0749
+-4.2373
+-4.3931
+-4.5418
+-4.6828
+-4.8157
+-4.9398
+-5.0549
+-5.1604
+-5.2559
+-5.3412
+-5.4158
+-5.4796
+-5.5323
+-5.5737
+-5.6036
+-5.6220
+-5.6287
+-5.6238
+-5.6034
+-5.5637
+-5.5052
+-5.4285
+-5.3343
+-5.2237
+-5.0977
+-4.9576
+-4.8049
+-4.6411
+-4.4679
+-4.2871
+-4.1004
+-3.9099
+-3.7173
+-3.5200
+-3.3226
+-3.1253
+-2.9280
+-2.7306
+-2.5333
+-2.3359
+-2.1386
+-1.9412
+-1.7439
+-1.5466
+-1.3492
+-1.1519
+-0.9545
+-0.7572
+-0.5599
+-0.3625
+-0.1652
+0.0322
+0.2295
+0.4269
+0.6242
+0.8215
+1.0189
+1.2162
+1.4136
+1.6109
+1.8083
+2.0056
+2.2029
+2.4003
+2.5976
+2.7950
+2.9923
+3.1897
+3.3870
+3.5843
+3.7817
+3.9697
+4.1559
+4.3382
+4.5148
+4.6839
+4.8438
+4.9929
+5.1295
+5.2524
+5.3603
+5.4520
+5.5266
+5.5834
+5.6223
+5.6483
+5.6614
+5.6614
+5.6484
+5.6224
+5.5836
+5.5322];
+
+r_tri_sup = [...
+    7.5760
+6.8324];
+
+z_tri_sup = [...
+    -2.6054
+-3.1814];
+
+r_div_inboard_rail = [...
+   3.6895
+3.6895];
+
+z_div_inboard_rail = [...
+-3.3207
+-2.6698];
+
+
+vessel_data.in.r = rin;
+vessel_data.in.z = zin;
+vessel_data.in.thick = 0.06;
+vessel_data.in.R = 0.8;
+vessel_data.in.unit_thick = '[m]';
+vessel_data.in.unit_R = '[mu Omega m]';
+
+
+vessel_data.out.r = rout;
+vessel_data.out.z = zout;
+vessel_data.out.thick = 0.06;
+vessel_data.out.R = 0.8;
+vessel_data.out.unit_thick = '[m]';
+vessel_data.out.unit_R = '[mu Omega m]';
+
+
+vessel_data.triangular_support.r = r_tri_sup;
+vessel_data.triangular_support.z = z_tri_sup;
+vessel_data.triangular_support.thick = 0.06;
+vessel_data.triangular_support.R = 0.8;
+vessel_data.triangular_support.unit_thick = '[m]';
+vessel_data.triangular_support.unit_R = '[mu Omega m]';
+
+
+
+vessel_data.div_inboard_rail.r = r_div_inboard_rail;
+vessel_data.div_inboard_rail.z = z_div_inboard_rail;
+vessel_data.div_inboard_rail.thick = 0.08;
+vessel_data.div_inboard_rail.R = 0.9;
+vessel_data.div_inboard_rail.unit_thick = '[m]';
+vessel_data.div_inboard_rail.unit_R = '[mu Omega m]';
+
+
+end
diff --git a/matlab/IMAS/gdat_imas.m b/matlab/IMAS/gdat_imas.m
index 5850cc9ac9fb88125ac6b39f3f10a8b04fa8f02a..0e2cf4d7512f4d98717b814edefc5fb629813db3 100644
--- a/matlab/IMAS/gdat_imas.m
+++ b/matlab/IMAS/gdat_imas.m
@@ -477,11 +477,35 @@ elseif strcmp(mapping_for_imas.method,'switchcase')
 	gdat_data.([ids_top_name '_help']) = getReport(ME_imas_ids_get);
 	rethrow(ME_imas_ids_get)
       end
+      % check homogeneous
+      switch gdat_data.(ids_top_name).ids_properties.homogeneous_time
+       case -999999999
+	warning([ids_top_name '.ids_properties.homogeneous_time is not defined']);
+	if isempty(gdat_data.(ids_top_name).time)
+	  gdat_data.(ids_top_name).ids_properties.homogeneous_time = 0;
+	  warning([ids_top_name '.ids_properties.homogeneous_time set to 0 since .time empty']);
+	elseif isfinite(gdat_data.(ids_top_name).time)
+	  gdat_data.(ids_top_name).ids_properties.homogeneous_time = 1;
+	  warning([ids_top_name '.ids_properties.homogeneous_time set to 1 since .time finite']);
+	end
+       case 0
+	if ~isempty(gdat_data.(ids_top_name).time)
+	  disp([ids_top_name '.ids_properties.homogeneous_time=0 but .time not empty, to check'])
+	end
+       case 1
+	if isempty(gdat_data.(ids_top_name).time)
+	  disp([ids_top_name '.ids_properties.homogeneous_time=1 but .time empty, to check'])
+	end
+       otherwise
+	warning([ids_top_name '.ids_properties.homogeneous_time = ' num2str(gdat_data.(ids_top_name).ids_properties.homogeneous_time) ...
+		 ' not sure what to check'])
+      end
       % Perform cocos transformation if cocos_out ~= cocos_in
       if gdat_data.gdat_params.cocos_in ~= gdat_data.gdat_params.cocos_out
 	[ids_out,cocoscoeff]=ids_generic_cocos_nodes_transformation_symbolic(gdat_data.(ids_top_name),ids_top_name, ...
 	  gdat_data.gdat_params.cocos_in, gdat_data.gdat_params.cocos_out, gdat_data.gdat_params.ipsign_out,gdat_data.gdat_params.b0sign_out, ...
 	  gdat_data.gdat_params.ipsign_in, gdat_data.gdat_params.b0sign_in);
+	gdat_data.(ids_top_name) = ids_out;
       end
     end
     
diff --git a/matlab/IMAS/gen_filament.m b/matlab/IMAS/gen_filament.m
new file mode 100644
index 0000000000000000000000000000000000000000..88b402c23383848051d988987f6a49323c7bfcc5
--- /dev/null
+++ b/matlab/IMAS/gen_filament.m
@@ -0,0 +1,125 @@
+function  [discretizationr, discretizationz, Twc] = gen_filament(vvdata, num, type_coil_description,varargin)
+% Generate filamentary(windings) discretization, and grouping matrix, from different geometrical coil descriptions
+
+% type_coil_description = 2 -> rectangle description
+% type_coil_description = 3 -> oblique description
+% type_coil_description = 4 -> contour of the coils are specified varargin = [r, z ] contours
+% vvdata =  R, Z, dR, dZ for type_coil_description = 2.  
+% vvdata =  R, Z, dR, dZ, AC, AC2 for type_coil_description = 3 where AC, AC2 are the angles of the parallelogram. 
+
+R = vvdata(1, :);
+Z = vvdata(2, :);
+dR = vvdata(3, :);
+dZ = vvdata(4, :);
+switch type_coil_description
+    case 1 % outline option
+        error('Filamentary discretization for ''outline'' coils description in ids type_coil_description not yet implmented')
+    case 2 % rectangle
+        AC = 0*ones(size(R));
+        AC2 = 90*ones(size(R));
+    case 3 % oblique (parallelogram)
+        AC = vvdata(5, :);
+        AC2 = vvdata(6, :);
+    case 4 % contour of the polygon
+        error('Filamentary discretizaion for ''polygon'' coils description in  ids typ not yet implemented')
+    otherwise
+        error('Coils description not supported for filamenteray discretization ')
+end
+        
+% Initialize the extrema of the trapezoid
+pointr = zeros(numel(AC),4);
+pointz = zeros(numel(AC),4);
+discretizationr = [];
+discretizationz = [];
+Twc = []; % Grouping matrix from coils to windings Iw = Twc*Ic
+for ii = 1:numel(AC) % loop all the coils given vvstructure
+    % Find 4 extrema of the parallelogram. Working both for rectangular description and parallelogram description
+    %   D----C
+    %  /    /
+    % A----B
+    if  AC2(ii) ~= 0 && AC(ii) ==0 
+        DH = dZ(ii)/tand(AC2(ii));
+        pointr(ii,1) = R(ii) -DH/2 -dR(ii)/2;
+        pointr(ii,2) = R(ii) +DH/2 -dR(ii)/2;
+        pointr(ii,3) = R(ii) +DH/2 +dR(ii)/2;
+        pointr(ii,4) = R(ii) -DH/2 +dR(ii)/2;
+        pointz(ii,1) = Z(ii) -dZ(ii)/2;
+        pointz(ii,2) = Z(ii) +dZ(ii)/2;
+        pointz(ii,3) = Z(ii) +dZ(ii)/2;
+        pointz(ii,4) = Z(ii) -dZ(ii)/2;
+    elseif AC(ii) ~= 0 && AC2(ii) ==0 % Parallelogramm
+        DH = dR(ii)*tand(AC(ii));
+        pointr(ii,1) = R(ii) - dR(ii)/2;
+        pointr(ii,2) = R(ii) - dR(ii)/2;
+        pointr(ii,3) = R(ii) + dR(ii)/2;
+        pointr(ii,4) = R(ii) + dR(ii)/2;
+        pointz(ii,1) = Z(ii) - DH/2- dZ(ii)/2;
+        pointz(ii,2) = Z(ii) - DH/2 +dZ(ii)/2;
+        pointz(ii,3) = Z(ii) + DH/2 +dZ(ii)/2;
+        pointz(ii,4) = Z(ii) + DH/2 -dZ(ii)/2;
+    elseif AC2(ii) == 0 && AC(ii) ==0 % Rectangular description 
+        % 2----3
+        % |    |
+        % 1----4
+        pointr(ii,1) = R(ii)  -dR(ii)/2;
+        pointr(ii,2) = R(ii)  -dR(ii)/2;
+        pointr(ii,3) = R(ii)  +dR(ii)/2;
+        pointr(ii,4) = R(ii)  +dR(ii)/2;
+        pointz(ii,1) = Z(ii) -dZ(ii)/2;
+        pointz(ii,2) = Z(ii) +dZ(ii)/2;
+        pointz(ii,3) = Z(ii) +dZ(ii)/2;
+        pointz(ii,4) = Z(ii) -dZ(ii)/2;
+    end
+    % Define base vector of the 2D deformed space for the parallelogram
+    AD = [pointr(ii,4)-pointr(ii,1), pointz(ii,4)-pointz(ii,1)];
+    AB = [pointr(ii,2)-pointr(ii,1), pointz(ii,2)-pointz(ii,1)];
+    ex = [1,0];
+    ey = [0,1];
+    
+    % Rotation matrix containing the scalar product of the deformed space
+    % and orthogonal space
+    S = ([ex*AD', ex*AB'; ey*AD', ey*AB']);
+    
+    % Try to use a number of filaments that respect the shape of the parallelogram
+    ratio = sqrt((AD*AD'))/sqrt((AB*AB'));
+    num1 = ceil(sqrt(num(ii)*ratio));
+    num2 = ceil(num1/ratio);
+    
+    pointx = zeros(num1*num2, 1);
+    pointy = zeros(num1*num2, 1);
+    for kk=1:num1
+        for jj=1:num2
+            pointx((kk-1)*num1+jj) = (2*kk-1)/(2*num1); %uniform grid in the deformed space defined by the parallelogram
+            pointy((kk-1)*num2+jj) = (2*jj-1)/(2*num2);
+            tmp = S*[pointx((kk-1)*(num1)+jj), pointy((kk-1)*(num2)+jj)]'; % evaluate component in the r,z system of reference
+            discretizationr(end+1) = pointr(ii,1) + tmp(1) ; % translate to the original central location
+            discretizationz(end+1) = pointz(ii,1) + tmp(2);  % translate to the original central location
+        end
+    end
+    % Only the number of turns is specified but not the position of
+    % each individual winding. The function eval_trap generates a winding
+    % distrubution that nicely resamble the geometry of the coil section,
+    % but will not necessarily generate a number of windings = number of
+    % turns. The following normalization garanties that the total current
+    % flowing in the cross section of coil Iw*nw = Ia*nturns respects the input data.
+    Twc(end+1:end+num1*num2,end+1) = 1*sign(num(ii))/(num1*num2)*num(ii);
+end
+
+% Reshape filaments(windings) into unique vector
+discretizationr = reshape(discretizationr, numel(discretizationr),1);
+discretizationz = reshape(discretizationz, numel(discretizationz),1);
+
+% Plot the coils discretization
+if ~isempty(varargin) && varargin{1} == 1
+    figure
+    hold on
+    axis equal
+    for ii = 1:numel(AC) % loop all the coils
+        patch(pointr(ii,:),pointz(ii,:),'red');
+    end
+    scatter(discretizationr, discretizationz, '.');
+end
+
+end
+
+
diff --git a/matlab/TCV_IMAS/ids2database.m b/matlab/TCV_IMAS/ids2database.m
index f9e2d2551389b95278dcbc2fa25a068262e9d8eb..abbbfaec4f3ceac08b0529a6f04f46347b84c79c 100644
--- a/matlab/TCV_IMAS/ids2database.m
+++ b/matlab/TCV_IMAS/ids2database.m
@@ -25,8 +25,8 @@ p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x))))
 p.addOptional('run', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
 p.addOptional('occurence', 0, @(x) isempty(x) || (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer
 p.addOptional('ids2put', struct([]), @(x) (isstruct(x)));
-p.addOptional('tree_user', tree_user_default, @(x) (ischar(x)));
-p.addOptional('tree_tokamak', tree_tokamak_default, @(x) (ischar(x)));
+p.addOptional('tree_user', tree_user_default, @(x) (isempty(x) || ischar(x)));
+p.addOptional('tree_tokamak', tree_tokamak_default, @(x) (isempty(x) || ischar(x)));
 p.addOptional('tree_majorversion', tree_majorversion_default, @(x) (ischar(x)));
 
 p.parse;
@@ -66,7 +66,15 @@ end
 names = fieldnames(params);
 mask = structfun(@isempty,params);
 if any(mask),
-  params = rmfield(params,unique([names(mask); p.UsingDefaults.']));
+  ij=find(mask==1);
+  for i=1:length(ij)
+    params.(names{ij(i)}) = defaults_ids2database.(names{ij(i)});
+  end
+  mask2 = structfun(@isempty,params);
+  if any(mask2),
+    % rm remaining empty fields
+    params = rmfield(params,unique([names(mask2)]));
+  end
 end
 
 params_ids2database = params;