function R=Run_jktebopID_T9(varargin)
R=[];
home=cd;
TempFolder='temp';
if nargin==0
    ID=0;
    SetExp;
    %load('Exp.mat')
elseif nargin==1
    ID=varargin{1};
elseif nargin==2
    ID=varargin{1};
    E=varargin{2};
    Y=E.F;
else
    ID=varargin{1};
    E=varargin{2};
    Y=varargin{3};
end
TempFolder=[TempFolder num2str(ID)];
Start(home,TempFolder)

E.folder=[home '/'  TempFolder];
cd([home '/'  TempFolder])
for i=1:size(Y,1)
    disp(['ID=' num2str(ID) ' Iteration=' num2str(i)])
    E.file=['F' num2str(i)];
    E.F=Y(i,:);
    E.Mag=-2.5*log(E.F)/log(10);
    ImputParameters(E)
    s=sprintf('./jktebop F%d.in>F%d.log',i,i);
    %s=sprintf('./jktebop F%d.in',i);
    unix(s);

end
R=ReadResult(home,TempFolder,size(Y,1));
cd(home)
Eliminar(home,TempFolder)
disp(['Jktebop ID: ' num2str(ID) ' Tedminado'])
end

function Start(home,TempFolder)
if exist([home '/' TempFolder],'dir')
    rmdir([home '/' TempFolder],'s')
end
mkdir([home '/' TempFolder])
copyfile([home '/jktebop.f'],[home '/' TempFolder])
cd([home '/' TempFolder])
%unix('xterm -e gfortran -o jktebop jktebop.f');
unix('gfortran -o jktebop jktebop.f');
cd(home)
end

function Eliminar(home,TempFolder)
rmdir([home '/' TempFolder],'s')
end

function ImputParameters(E)
fid1 = fopen([E.folder '/' E.file '.in'],'w');
fid2 = fopen([E.folder '/' E.file '.dat'],'w');
for i=1:length(E.t);
    fprintf(fid2,'%f %f  \n',E.t(i),E.Mag(i));
end
fprintf(fid1,'%g %g             Task to do (from 2 to 9)   Integ. ring size (deg)  \n',9,1);
fprintf(fid1,'%g %g             Sum of the radii           Ratio of the radii      \n',(E.p+1)/E.ap,E.p);
fprintf(fid1,'%g %g             Orbital inclination (deg)  Mass ratio of system    \n',E.Inclination,-1);
fprintf(fid1,'%g %g             ecosw or eccentricity      esinw or periastron long\n',0,0);
fprintf(fid1,'%g %g             Gravity darkening (star A) Grav darkening (star B) \n',1,1);
fprintf(fid1,'%g %g             Surface brightness ratio   Amount of third light   \n',0,0);
fprintf(fid1,'%s %s             LD law type for star A     LD law type for star B  \n','quad','lin');
fprintf(fid1,'%g %g             LD star A (linear coeff)   LD star B (linear coeff)\n',E.LLD,0);
fprintf(fid1,'%g %g             LD star A (nonlin coeff)   LD star B (nonlin coeff)\n',E.QLD,0);
fprintf(fid1,'%g %g             Reflection effect star A   Reflection effect star B\n',0,0);
fprintf(fid1,'%g %g             Phase of primary eclipse   Light scale factor (mag)\n',0,1);
fprintf(fid1,'%g                Orbital period of eclipsing binary system (days) \n',E.Period);
fprintf(fid1,'%g                Reference time of primary minimum (HJD)          \n',E.MidTransit);
fprintf(fid1,' %g  %g             Adjust RADII SUM    or  RADII RATIO    (0, 1, 2, 3)\n',E.Fit_Radius,E.Fit_Radius);
fprintf(fid1,' %g  0             Adjust INCLINATION  or  MASSRATIO      (0, 1, 2, 3)\n',E.Fit_Inclination);
fprintf(fid1,' 0  0             Adjust ECOSW-or-E   or  ESINW-or-OMEGA (0, 1, 2, 3)\n');
fprintf(fid1,' 0  0             Adjust GRAVDARK1    or  GRAVDARK2      (0, 1, 2, 3)\n');
fprintf(fid1,' 0  0             Adjust SURFBRIGHT2  or  THIRDLIGHT     (0, 1, 2, 3)\n');
fprintf(fid1,' %g  0             Adjust LD-LIN starA or  LD-LIN starB   (0, 1, 2, 3)\n',E.Fit_LP);
fprintf(fid1,' %g  0             Adjust LD-NONLIN A  or  LD-NONLIN B    (0, 1, 2, 3)\n',E.Fit_LP);
fprintf(fid1,' 0  0             Adjust REFLECTION A or  REFLECTION B   (-1,0,1,2,3)\n');
fprintf(fid1,' 0  %g             Adjust PHASESHIFT   or  SCALE FACTOR   (0, 1, 2, 3)\n',E.Fit_ScaleFactor);
fprintf(fid1,' %g  %g             Adjust PERIOD       or  T(pri.ecl.)    (0, 1, 2, 3)\n',E.Fit_Period,E.Fit_MidT);
fprintf(fid1,'%s.dat            Name of file containing light curve                \n',E.file);
fprintf(fid1,'%s.par            Name of output parameter file                      \n',E.file);
%fprintf(fid1,'%s.out            Name of output light curve file                  \n',E.file);
%fprintf(fid1,'%s.fit            Name of output model light curve fit file        \n',E.file);
fprintf(fid1,'%s.fit            Name of output file of individual fits           \n',E.file);
fprintf(fid1,'  \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# Enter the appropriate numbers on the left-hand side of each line of this file.\n');
fprintf(fid1,'# Most of the lines require two numerical parameters separated by spaces.       \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# Put a negative number for the mass ratio to force the stars to be spherical.  \n');
fprintf(fid1,'# The mass ratio will then be irrelevant (it is only used to get deformations). \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# To fit for rA and rB instead of (rA+rB) and k, give a negative value for r1+r2\n');
fprintf(fid1,'# Then (rA+rB) will be interpreted to mean rA,  and k will be interpreted as rB.\n');
fprintf(fid1,'# The adjustment indicators will similarly refer to rA,rB rather than (rA+rB),k.\n');
fprintf(fid1,'  \n');
fprintf(fid1,'# If e < 10 then e and omega will be assumed to be e*cos(omega) and e*sin(omega)\n');
fprintf(fid1,'# If e >= 10 then e and omega will be assumed to be (e+10) and omega (degrees). \n');
fprintf(fid1,'# The first option is in general better unless eccentricity is larger or fixed. \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# The possible entries for the type of limb darkening law are ''lin'' (for linear)\n');
fprintf(fid1,'# ''log'' (logarithmic), ''sqrt'' (square-root), ''quad'' (quadratic) or ''cub'' (cubic)\n');
fprintf(fid1,'# Put ''same'' for star B to force its coefficients to be equal those of star A.  \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# For each adjustable parameter the adjustment integer can be 0  (parameter will\n');
fprintf(fid1,'# be fixed at the input file value),  1 (parameter will be freely adjusted),  2 \n');
fprintf(fid1,'# (parameter will be fixed for initial fit but perturbed during later analysis).\n');
fprintf(fid1,'# or  3 (adjusted in initial fit but not perturbed during Monte Carlo analysis).\n');
fprintf(fid1,'  \n');
fprintf(fid1,'# When fitting a light curve  the reflection coefficients can be calculated from\n');
fprintf(fid1,'# the system geometry  (put -1 for the adjustment integers),  held fixed (put 0)\n');
fprintf(fid1,'# or freely adjusted to fit the light curve (put 1) - useful for close binaries.\n');
fprintf(fid1,'  \n');
fprintf(fid1,'# FOUR-PARAMETER LIMB DARKENING:   you can alternatively put ''4par'' for the limb\n');
fprintf(fid1,'# darkening in which case the input file format differs a bit. Change the lines:\n');
fprintf(fid1,'#                   LD star A (linear coeff)   LD star B (linear coeff)         \n');
fprintf(fid1,'#                   LD star A (nonlin coeff)   LD star B (nonlin coeff)         \n');
fprintf(fid1,'# to the following lines and put in the information at the line starts as usual:\n');
fprintf(fid1,'#                   LD star A (coefficient 1) LD star B (coefficient 1)         \n');
fprintf(fid1,'#                   LD star A (coefficient 2) LD star B (coefficient 2)         \n');
fprintf(fid1,'#                   LD star A (coefficient 3) LD star B (coefficient 3)         \n');
fprintf(fid1,'#                   LD star A (coefficient 4) LD star B (coefficient 4)         \n');
fprintf(fid1,'# You also need to change the lines for the adjustment parameters from:         \n');
fprintf(fid1,'#                   Adjust LD-lin1  or  LD-lin2            (0, 1, 2, 3)         \n');
fprintf(fid1,'#                   Adjust LD-nonlin1  or  LD-nonlin2      (0, 1, 2, 3)         \n');
fprintf(fid1,'# to the following lines and put in the information at the line starts as usual:\n');
fprintf(fid1,'#                   Adjust LDcoeff-A1 or LDcoeff-B1        (0, 1, 2, 3)         \n');
fprintf(fid1,'#                   Adjust LDcoeff-A2 or LDcoeff-B2        (0, 1, 2, 3)         \n');
fprintf(fid1,'#                   Adjust LDcoeff-A3 or LDcoeff-B3        (0, 1, 2, 3)         \n');
fprintf(fid1,'#                   Adjust LDcoeff-A4 or LDcoeff-B4        (0, 1, 2, 3)         \n');
fprintf(fid1,'# Remember not to include the ''#'' symbol: it is used only to comment lines out. \n');
fprintf(fid1,'# Reference for the ''4par'' law: Claret (2000, A&A, 363, 1081)                   \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# TIMES OF MINIMUM LIGHT: add a line below the parameter line to input each one:\n');
fprintf(fid1,'#   ''TMIN  [cycle]  [time]  [error]''                                            \n');
fprintf(fid1,'# where [cycle] is cycle number (integer for primary minimum  or integer+0.5 for\n');
fprintf(fid1,'# secondary minimum), [time] and [error] are the observed time and uncertainty. \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# LIGHT RATIO: add a line below the parameter line to input each observed one:  \n');
fprintf(fid1,'#   ''LRAT''  [time]  [light_ratio]  [error]                                      \n');
fprintf(fid1,'# where [time] is the time(HJD) when the spectroscopic light ratio was measured,\n');
fprintf(fid1,'# [light_ratio] is its value and [error] is its measurement uncertainty.        \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# MEASURED THIRD LIGHT VALUE:   include as observed constraint by adding a line:\n');
fprintf(fid1,'# ''THDL''  [value]  [uncertainty]        \n');
fprintf(fid1,'# which gives the third light measurement and its observational uncertainty.    \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# MEASURED orbital shape parameters (depending on the value of eccentricity):   \n');
fprintf(fid1,'#  ECSW  [value]  [uncertainty]    (interpreted as either e*cos(omega) or e)    \n');
fprintf(fid1,'#  ENSW  [value]  [uncertainty]    (interpreted as either e*sin(omega) or omega)\n');
fprintf(fid1,'  \n');
fprintf(fid1,'# SINE AND POLYNOMIAL FITTING:   the parameters of sine curves or polynomials of\n');
fprintf(fid1,'# order 5) can be included.  You can have up to nine sines and five polynomials,\n');
fprintf(fid1,'# each acting on a specific parameter. The information for each one is specified\n');
fprintf(fid1,'# by an additional line below the main input file parameters.     Line format:  \n');
fprintf(fid1,'#   SINE  [par]  [T0]  [P]  [amp]  [vary(T0)]  [vary(P)]  [vary(amp)]           \n');
fprintf(fid1,'#   POLY  [par]  [pivot]  [const]  [x]  [x^2]  [x^3] [x^4]  [x^5]  [vary(const)]  [vary(x)]  [vary(x^2)]  [vary(x^3)]   [vary(x^4)]   [vary(x^5)]               \n');
fprintf(fid1,'# where the required parameters are given inside square brackets. [T0] is a time\n');
fprintf(fid1,'# of zero phase (HJD), [P] is period (days), [amp] is amplitude, and [x^n] are  \n');
fprintf(fid1,'# the coefficients of the polynomial.  Each parameter has a [vary()] which is 0,\n');
fprintf(fid1,'# 1, 2 or 3 to indicate how the parameter is treated.                           \n');
fprintf(fid1,'# [par] indicates what parameter to apply it to: J r1 r2 i L3 sf L1 L2 e w ec ew\n');
fprintf(fid1,'# where sf indicates scale factor, L1 indicates the light from star A, L2 indic-\n');
fprintf(fid1,'# ates the light from star B, ec indicates ecosw and es indicates esinw.        \n');
fprintf(fid1,'# Note that the independent parameter is always time (either HJD or phase).     \n');
fprintf(fid1,'# If you want to apply a polynomial to only part of the data, in a specific time\n');
fprintf(fid1,'# interval, then use the following line           to give the extra information:\n');
fprintf(fid1,'#   POLY  [par]  [pivot]  [const] [x] [x^2] [x^3] [x^4] [x^5]  [vary(const)] [vary(x)] [vary(x^2)] [vary(x^3)] [vary(x^4)] [vary(x^5)]  [start-time]  [end-time]\n');
fprintf(fid1,'# JKTEBOP will check for the two extra numbers and use them automatically.      \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# NUMERICAL INTEGRATION:  long exposure times can be split up into NUMINT points\n');
fprintf(fid1,'# occupying a total time interval of NINTERVAL (seconds) by including this line:\n');
fprintf(fid1,'#   NUMI  [numint]  [ninterval]                                                 \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# FITTING FOR RADIAL VELOCITIES:    the observed RVs should be in separate files\n');
fprintf(fid1,'# for the two stars and the data should be in the same format as the light curve\n');
fprintf(fid1,'# data. Then add a line below the main input parameters for each RV file:       \n');
fprintf(fid1,'#   RV1  [infile]  [outfile]  [K]  [Vsys]  [vary(K)]  [vary(Vsys)]              \n');
fprintf(fid1,'#   RV2  [infile]  [outfile]  [K]  [Vsys]  [vary(K)]  [vary(Vsys)]              \n');
fprintf(fid1,'# where RV1 is for primary star velocities, RV2 is for secondary star velocities\n');
fprintf(fid1,'# [infile] is the input data file, [outfile] is the output data file, [K] is the\n');
fprintf(fid1,'# velocity amplitude of the star (km/s), [Vsys] is its systemic velocity (km/s),\n');
fprintf(fid1,'# and [vary(K)] and [vary(Vsys)] are 0 to fix and 1 to fit for these quantities.\n');
fprintf(fid1,'# The mass ratio parameter is not used for the RVs, only for the light curve.   \n');
fprintf(fid1,'# If you want to fix the systemic velocity for star B to that for star A, simply\n');
fprintf(fid1,'# set vary(Vsys) for star B to be equal to -1                                   \n');
fprintf(fid1,'  \n');
fprintf(fid1,'# ERROR BARS IN THE DATAFILES: whenever JKTEBOP reads in a set of data from file\n');
fprintf(fid1,'# it checks to see if there are three numbers on the first line.  If so, JKTEBOP\n');
fprintf(fid1,'# assumes that the datafile contains three columns (TIME, OBSERVATION, ERRORBAR)\n');
fprintf(fid1,'# and reads the data in accordingly. If it can only find two numbers, it assumes\n');
fprintf(fid1,'# that these represent TIME, OBSERVATION  and that error bars are not available.\n');
fprintf(fid1,'# If errorbars are not available, or if they are too large or too small, JKTEBOP\n');
fprintf(fid1,'# can iteratively scale them until a reduced chi-squared of 1.0 is obtained.  To\n');
fprintf(fid1,'# use this option put the word ''chif'' ona line on its own below the main set of \n');
fprintf(fid1,'# parameters.  Warning: this is available only for light curves with ten or more\n');
fprintf(fid1,'# datapoints and for RV curves with five or more datapoints. Be careful!        \n');
fprintf(fid1,'  \n');
fprintf(fid1,'  \n');
fclose(fid1);
fclose(fid2);
end

function Out=ReadResult(home,TempFolder,N)
Out=[];
Ref={
'1Surf.bright.ratio'
'2Sumoffracradii'
'3Ratiooftheradii'
'4LimbdarkeningA1'
'5LimbdarkeningB1'
'6Orbitinclination'
'7ecc*cos(omega)'
'8ecc*sin(omega)'
'9GravdarkeningA'
'10GravdarkeningB'
'11ReflectedlightA'
'12ReflectedlightB'
'13Photmassratio'
'15Thirdlight(L_3)'
'16Phasecorrection'
'17Lightscalefactor'
'18Integrationring'
'19Orbitalperiod(P)'
'20Ephemeristimebase'
'21LimbdarkeningA2'
};
for i=1:N
%     fid1 = fopen([home '/' TempFolder '/F' num2str(i) '.out'],'r');
%     fgetl(fid1);
%     L=fgetl(fid1);
%     n=0;
%     while ischar(L)
%         n=n+1;
%         X=sscanf(L,'%f %f %f %f %f %f');
%         Out(i).TIME(n)=X(1);
%         Out(i).MAGNITUDE(n)=X(2);
%         Out(i).ERROR(n)=X(3);
%         Out(i).PHASE(n)=X(4);
%         Out(i).MODEL(n)=X(5);
%         Out(i).OC(n)=X(6);
%         L=fgetl(fid1);
%     end
%     fclose(fid1);
    
    fid1 = fopen([home '/' TempFolder '/F' num2str(i) '.par'],'r');
    L1=fgetl(fid1);
    fid2 = fopen([home '/' TempFolder '/F' num2str(i) '.par'],'r');
    L2=fgetl(fid2);
    
    while ischar(L1)&&~strcmp('Initialvaluesoftheparameters:',L1(L1~=32))  
        L1=fgetl(fid1);
    end
    while ischar(L2)&&~strcmp('Finalvaluesoftheparameters:',L2(L2~=32))
        L2=fgetl(fid2);
    end
    
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{5} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_SumR=sscanf(L1(L1~=32),[Ref{2} '%f']);
    Out(i).F_SumR=sscanf(L2(L2~=32),[Ref{2} '%f']);
    Out(i).E_SumR=100*abs((Out(i).F_SumR-Out(i).I_SumR)/Out(i).I_SumR);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_RatioR=sscanf(L1(L1~=32),[Ref{3} '%f']);
    Out(i).F_RatioR=sscanf(L2(L2~=32),[Ref{3} '%f']);
    Out(i).E_RatioR=100*abs((Out(i).F_RatioR-Out(i).I_RatioR)/Out(i).I_RatioR);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_LLD=sscanf(L1(L1~=32),[Ref{4} '%f']);
    Out(i).F_LLD=sscanf(L2(L2~=32),[Ref{4} '%f']);
    Out(i).E_LLD=100*abs((Out(i).F_LLD-Out(i).I_LLD)/Out(i).I_LLD);
    Out(i).I_QLD=[];
    Out(i).F_QLD=[];
    Out(i).E_QLD=[];
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{5} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_Inclination=sscanf(L1(L1~=32),[Ref{6} '%f']);
    Out(i).F_Inclination=sscanf(L2(L2~=32),[Ref{6} '%f']);
    Out(i).E_Inclination=100*abs((Out(i).F_Inclination-Out(i).I_Inclination)/Out(i).I_Inclination);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{7} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{8} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{9} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{10} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{11} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{12} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{13} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{14} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{15} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{16} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    %sscanf(L(L~=32),[Ref{17} '%f']);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_Period=sscanf(L1(L1~=32),[Ref{18} '%f']);
    Out(i).F_Period=sscanf(L2(L2~=32),[Ref{18} '%f']);
    Out(i).E_Period=100*abs((Out(i).F_Period-Out(i).I_Period)/Out(i).I_Period);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_MidT=sscanf(L1(L1~=32),[Ref{19} '%f']);
    Out(i).F_MidT=sscanf(L2(L2~=32),[Ref{19} '%f']);
    Out(i).E_MidT=100*abs((Out(i).F_MidT-Out(i).I_MidT)/Out(i).I_MidT);
    L1=fgetl(fid1);L2=fgetl(fid2);
    Out(i).I_QLD=sscanf(L1(L1~=32),[Ref{20} '%f']);
    Out(i).F_QLD=sscanf(L2(L2~=32),[Ref{20} '%f']);
    Out(i).E_QLD=100*abs((Out(i).F_QLD-Out(i).I_QLD)/Out(i).I_QLD);
    fclose(fid1);
    fclose(fid2);
    
    fid1 = fopen([home '/' TempFolder '/F' num2str(i) '.par'],'r');
    L1=fgetl(fid1);
    fid2 = fopen([home '/' TempFolder '/F' num2str(i) '.par'],'r');
    L2=fgetl(fid2);
    L1=L1(L1~=32);
    L2=L2(L2~=32);
    while ischar(L1)&&~strcmp('Bestfitone_sigmamedian+68.27%-68.27%',L1(L1~=32))  
        L1=fgetl(fid1);
        L1=L1(L1~=32);
    end
    while ischar(L2)&&~strcmp('Bestfittwo_sigmamedian+95.45%-95.45%',L2(L2~=32))
        L2=fgetl(fid2);
        L2=L2(L2~=32);
    end
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    
    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i rA+rB   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i rA+rB   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).SumR68=X1;
    Out(i).SumR95=X2;
    
    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i k   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i k   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).RatioR68=X1;
    Out(i).RatioR95=X2;

    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i LD_A1   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i LD_A1   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).LLD68=X1;
    Out(i).LLD95=X2;

    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i inc   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i inc   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).Inc68=X1;
    Out(i).Inc95=X2;

    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i sfact   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i sfact   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    %Out(i).fac68=X1;
    %Out(i).fac95=X2;

    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i P_orb   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i P_orb   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).P_orb68=X1;
    Out(i).P_orb95=X2;
    
    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i T_0   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i T_0   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).MidT68=X1;
    Out(i).MidT95=X2;

    L1=fgetl(fid1);L2=fgetl(fid2);
    %disp('------lineas-------')
    %disp(L1)
    %disp(L2)
    %disp('------salidas-------')
    X1=sscanf(L1,['%*i LD_A2   %f +/-  %f %f +  %f -  %f '])';
    X2=sscanf(L2,['%*i LD_A2   %f +/-  %f %f +  %f -  %f '])';
    %disp([X1; X2;])
    Out(i).QLD68=X1;
    Out(i).QLD95=X2;
    
    fclose(fid1);
    fclose(fid2);
    
end
end

