Code covered by the BSD License  

Highlights from
MIDAS 2010

image thumbnail

MIDAS 2010

by

 

Mid-Infrared Data Analysis Software 2010 A Matlab Package for 2D IR Spectroscopy Analysis

ExportPassfile(myfile, startX, endX, startY, endY)
function ExportPassfile(myfile, startX, endX, startY, endY)

[filename, pathname] = uiputfile('*.xls', 'Export Data','default');

% If user cancels save command, nothing happens
if isequal(filename,0) || isequal(pathname,0)
    return
end


%-----WRITING TO XLS-----%
original = pwd;
% Change directory to save in the appropriate location
cd(pathname);

temp = cell(30,3);

temp{1,1} = 'XLabel';
temp{1,2} = myfile.info.xlabel;
temp{2,1} = 'YLabel';
temp{2,2} = myfile.info.ylabel;
temp{3,1} = 'ZLabel';
temp{3,2} = myfile.info.zlabel;
temp{4,1} = 'XUnit';
temp{4,2} = myfile.info.xunit;
temp{5,1} = 'YUnit';
temp{5,2} = myfile.info.yunit;
temp{6,1} = 'ZUnit';
temp{6,2} = myfile.info.zunit;

temp{8,1} = 'deltaX';
temp{8,2} = myfile.info.deltaX;
temp{9,1} = 'deltaY';
temp{9,2} = myfile.info.deltaY;

temp{11,1} = 'Selected Data';
temp{12,1} = 'StartX';
temp{12,2} = myfile.timestep(startX);
temp{13,1} = 'EndX';
temp{13,2} = myfile.timestep(endX);
temp{14,1} = 'StartY';
temp{14,2} = myfile.variable(startY);
temp{15,1} = 'EndY';
temp{15,2} = myfile.variable(endY);

temp{17,1} = 'Data Setup';
temp{18,1} = 'Removed Static Component';
if myfile.info.staticComp == 0
    temp{18,2} = 'None Removed';
elseif myfile.info.staticComp == 1
    if myfile.info.component == 1
        temp{18,2} = 'Mean Spectrum';
    elseif myfile.info.component == 2
        temp{18,2} = 'Steady State (DC)';
    end
end

temp{19,1} = 'Applied Pre Filter';
if myfile.info.preFilter == 0
    temp{19,2} = 'No';
elseif myfile.info.preFilter == 1
    temp{19,2} = 'Yes';
end    

temp{20,1} = 'Applied Average';
if myfile.info.average == 0
    temp{20,2} = 'Not Averaged';
elseif myfile.info.average == 1
    if myfile.info.averageType == 1
        temp{20,2} = 'Kernel';
        temp{20,3} = myfile.info.deltaKerAve;
    elseif myfile.info.averageType == 2
        temp{20,2} = 'Dynamic';
        temp{20,3} = myfile.info.deltaDynAve;
    end
end   

temp{21,1} = 'Applied Post Filter';
if myfile.info.postFilter == 0
    temp{21,2} = 'No';
elseif myfile.info.postFilter == 1
    temp{21,2} = 'Yes';
end    


temp{23,1} = 'Plot Setup';
temp{24,1} = 'Scale Type';
if myfile.info.scaleType == 1
    temp{24,2} = 'Regular';
elseif myfile.info.scaleType == 2
    temp{24,2} = 'Variance';
    temp{24,3} = myfile.info.minSignal;
elseif myfile.info.scaleType == 3
    temp{24,2} = 'Range';
    temp{24,3} = myfile.info.minSignal;
end 



a = fieldnames(myfile.fileparts);
b = struct2cell(myfile.fileparts);
temp{26,1} = a{1};
temp{27,1} = a{2};
temp{28,1} = a{3};
temp{29,1} = a{4};
temp{30,1} = a{5};
temp{26,2} = b{1};
temp{27,2} = b{2};
temp{28,2} = b{3};
temp{29,2} = b{4};
temp{30,2} = b{5};

xlswrite(filename, temp, 'Information', 'A1');


xlswrite(filename, myfile.all, 'All Spectra', 'A1'); %Raw data


selecSpec = cell(4,2);
selecSpec{1,1} = 'StartX';
selecSpec{1,2} = myfile.timestep(startX);
selecSpec{2,1} = 'EndX';
selecSpec{2,2} = myfile.timestep(endX);
selecSpec{3,1} = 'StartY';
selecSpec{3,2} = myfile.variable(startY);
selecSpec{4,1} = 'EndY';
selecSpec{4,2} = myfile.variable(endY);
xlswrite(filename, selecSpec, 'Selected Spectra', 'A1'); %Selected Data
xlswrite(filename, myfile.data, 'Selected Spectra', 'A6'); %Selected Data

xlswrite(filename, myfile.selectVar, myfile.info.ylabel, 'A1'); %Selected variable
xlswrite(filename, myfile.timestep, myfile.info.xlabel, 'A1'); %Selected timestep

xlswrite(filename, myfile.corr, 'Corr', 'A1');
xlswrite(filename, myfile.syn, 'Synchronous', 'A1');
xlswrite(filename, myfile.asyn, 'Asynchronous', 'A1');
xlswrite(filename, myfile.phase, 'Phase', 'A1');
xlswrite(filename, myfile.Y_fft, 'Y_fft', 'A1');


if myfile.info.component == 2 && myfile.info.staticComp == 1 %Remove Steady State
    xlswrite(filename, myfile.staticSteadyState, 'Static Component', 'A1'); %Steady State Static array
elseif myfile.info.component == 1 && myfile.info.staticComp == 1 %Remove Mean Spectrum
    xlswrite(filename, myfile.staticMeanSpectrum, 'Static Component', 'A1'); %Mean spectrum static array
end


if myfile.info.preFilter == 1 %Apply pre filter
    if myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 1
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'Low Gaussian';
        prefilterInfo{2,1} = fieldnames(myfile.prefilter.LowGaussian); %Sigma
        prefilterInfo{2,2} = struct2cell(myfile.prefilter.LowGaussian);
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 2
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'Low Butterworth';
        a = fieldnames(myfile.prefilter.LowButterworth);
        b = struct2cell(myfile.prefilter.LowButterworth);
        prefilterInfo{2,1} = a{1}; %cutoff
        prefilterInfo{3,1} = a{2}; %order
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 3
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'Low Elliptical';
        a = fieldnames(myfile.prefilter.LowElliptical);
        b = struct2cell(myfile.prefilter.LowElliptical);
        prefilterInfo{2,1} = a{1}; %cutoffMajor
        prefilterInfo{3,1} = a{2}; %cutoffMinor
        prefilterInfo{4,1} = a{3}; %order
        prefilterInfo{5,1} = a{4}; %alpha
        prefilterInfo{6,1} = a{5}; %xOffset
        prefilterInfo{7,1} = a{6}; %tOffset
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        prefilterInfo{4,2} = b{3};
        prefilterInfo{5,2} = b{4};
        prefilterInfo{6,2} = b{5};
        prefilterInfo{7,2} = b{6};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 4
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'High Gaussian';
        prefilterInfo{2,1} = fieldnames(myfile.prefilter.HighGaussian); %Sigma
        prefilterInfo{2,2} = struct2cell(myfile.prefilter.HighGaussian);
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 5
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'High Butterworth';
        a = fieldnames(myfile.prefilter.HighButterworth);
        b = struct2cell(myfile.prefilter.HighButterworth);
        prefilterInfo{2,1} = a{1}; %cutoff
        prefilterInfo{3,1} = a{2}; %order
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 6
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'High Elliptical';
        a = fieldnames(myfile.prefilter.HighElliptical);
        b = struct2cell(myfile.prefilter.HighElliptical);
        prefilterInfo{2,1} = a{1}; %cutoffMajor
        prefilterInfo{3,1} = a{2}; %cutoffMinor
        prefilterInfo{4,1} = a{3}; %order
        prefilterInfo{5,1} = a{4}; %alpha
        prefilterInfo{6,1} = a{5}; %xOffset
        prefilterInfo{7,1} = a{6}; %tOffset
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        prefilterInfo{4,2} = b{3};
        prefilterInfo{5,2} = b{4};
        prefilterInfo{6,2} = b{5};
        prefilterInfo{7,2} = b{6};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 7
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'Bandpass';
        a = fieldnames(myfile.prefilter.Bandpass);
        b = struct2cell(myfile.prefilter.Bandpass);
        prefilterInfo{2,1} = a{1}; %cutin
        prefilterInfo{3,1} = a{2}; %cutoff
        prefilterInfo{4,1} = a{3}; %order
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        prefilterInfo{4,2} = b{3};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.prefilter.isViewed == 1 && myfile.prefilter.currPanel == 8
        prefilterInfo{1,1} = 'Type';
        prefilterInfo{1,2} = 'Highboost';
        a = fieldnames(myfile.prefilter.Highboost);
        b = struct2cell(myfile.prefilter.Highboost);
        prefilterInfo{2,1} = a{1}; %cutoff
        prefilterInfo{3,1} = a{2}; %order
        prefilterInfo{4,1} = a{3}; %boost
        prefilterInfo{2,2} = b{1};
        prefilterInfo{3,2} = b{2};
        prefilterInfo{4,2} = b{3};
        xlswrite(filename, prefilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.prefilter.H , 'Prefilter', 'A9'); %Prefilter
    end    
end



if myfile.info.postFilter == 1 %Apply post filter
    if myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 1
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'Low Gaussian';
        postfilterInfo{2,1} = fieldnames(myfile.postfilter.LowGaussian); %Sigma
        postfilterInfo{2,2} = struct2cell(myfile.postfilter.LowGaussian);
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 2
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'Low Butterworth';
        a = fieldnames(myfile.postfilter.LowButterworth);
        b = struct2cell(myfile.postfilter.LowButterworth);
        postfilterInfo{2,1} = a{1}; %cutoff
        postfilterInfo{3,1} = a{2}; %order
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 3
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'Low Elliptical';
        a = fieldnames(myfile.postfilter.LowElliptical);
        b = struct2cell(myfile.postfilter.LowElliptical);
        postfilterInfo{2,1} = a{1}; %cutoffMajor
        postfilterInfo{3,1} = a{2}; %cutoffMinor
        postfilterInfo{4,1} = a{3}; %order
        postfilterInfo{5,1} = a{4}; %alpha
        postfilterInfo{6,1} = a{5}; %xOffset
        postfilterInfo{7,1} = a{6}; %tOffset
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        postfilterInfo{4,2} = b{3};
        postfilterInfo{5,2} = b{4};
        postfilterInfo{6,2} = b{5};
        postfilterInfo{7,2} = b{6};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 4
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'High Gaussian';
        postfilterInfo{2,1} = fieldnames(myfile.postfilter.HighGaussian); %Sigma
        postfilterInfo{2,2} = struct2cell(myfile.postfilter.HighGaussian);
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 5
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'High Butterworth';
        a = fieldnames(myfile.postfilter.HighButterworth);
        b = struct2cell(myfile.postfilter.HighButterworth);
        postfilterInfo{2,1} = a{1}; %cutoff
        postfilterInfo{3,1} = a{2}; %order
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 6
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'High Elliptical';
        a = fieldnames(myfile.postfilter.HighElliptical);
        b = struct2cell(myfile.postfilter.HighElliptical);
        postfilterInfo{2,1} = a{1}; %cutoffMajor
        postfilterInfo{3,1} = a{2}; %cutoffMinor
        postfilterInfo{4,1} = a{3}; %order
        postfilterInfo{5,1} = a{4}; %alpha
        postfilterInfo{6,1} = a{5}; %xOffset
        postfilterInfo{7,1} = a{6}; %tOffset
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        postfilterInfo{4,2} = b{3};
        postfilterInfo{5,2} = b{4};
        postfilterInfo{6,2} = b{5};
        postfilterInfo{7,2} = b{6};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 7
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'Bandpass';
        a = fieldnames(myfile.postfilter.Bandpass);
        b = struct2cell(myfile.postfilter.Bandpass);
        postfilterInfo{2,1} = a{1}; %cutin
        postfilterInfo{3,1} = a{2}; %cutoff
        postfilterInfo{4,1} = a{3}; %order
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        postfilterInfo{4,2} = b{3};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    elseif myfile.postfilter.isViewed == 1 && myfile.postfilter.currPanel == 8
        postfilterInfo{1,1} = 'Type';
        postfilterInfo{1,2} = 'Highboost';
        a = fieldnames(myfile.postfilter.Highboost);
        b = struct2cell(myfile.postfilter.Highboost);
        postfilterInfo{2,1} = a{1}; %cutoff
        postfilterInfo{3,1} = a{2}; %order
        postfilterInfo{4,1} = a{3}; %boost
        postfilterInfo{2,2} = b{1};
        postfilterInfo{3,2} = b{2};
        postfilterInfo{4,2} = b{3};
        xlswrite(filename, postfilterInfo, 'Prefilter', 'A1'); %Prefilter
        xlswrite(filename, myfile.postfilter.H , 'Prefilter', 'A9'); %Prefilter
    end    
end



% Go back to original directory
cd(original);
disp('Done exporting to XLS! :)');


Contact us