%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
%    Workbook: /Volumes/Data2/TaraEuropa/Partner_data/LOV/HyperBOOST_2023_pa_spectro_LOV.xlsx
%    Worksheet: anap
%
% Auto-generated by MATLAB on 17-Feb-2024 14:17:43

%% Set up the Import Options and import the data
opts = spreadsheetImportOptions("NumVariables", 101);

% Specify sheet and range
opts.Sheet = "anap";
opts.DataRange = "A2:CW504";

% Specify column names and types
opts.VariableNames = ["Station", "VarName2", "VarName3", "VarName4", "VarName5", "VarName6", "VarName7", "VarName8", "VarName9", "VarName10", "VarName11", "VarName12", "VarName13", "VarName14", "VarName15", "VarName16", "VarName17", "VarName18", "VarName19", "VarName20", "VarName21", "VarName22", "VarName23", "VarName24", "VarName25", "VarName26", "VarName27", "VarName28", "VarName29", "VarName30", "VarName31", "VarName32", "VarName33", "VarName34", "VarName35", "VarName36", "VarName37", "VarName38", "VarName39", "VarName40", "VarName41", "VarName42", "VarName43", "VarName44", "VarName45", "VarName46", "VarName47", "VarName48", "VarName49", "VarName50", "VarName51", "VarName52", "VarName53", "VarName54", "VarName55", "VarName56", "VarName57", "VarName58", "VarName59", "VarName60", "VarName61", "VarName62", "VarName63", "VarName64", "VarName65", "VarName66", "VarName67", "VarName68", "VarName69", "VarName70", "VarName71", "VarName72", "VarName73", "VarName74", "VarName75", "VarName76", "VarName77", "VarName78", "VarName79", "VarName80", "VarName81", "VarName82", "VarName83", "VarName84", "VarName85", "VarName86", "VarName87", "VarName88", "VarName89", "VarName90", "VarName91", "VarName92", "VarName93", "VarName94", "VarName95", "VarName96", "VarName97", "VarName98", "VarName99", "VarName100", "VarName101"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "string", "string", "double", "double", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];

% Specify variable properties
opts = setvaropts(opts, ["VarName22", "VarName72", "VarName73", "VarName74", "VarName82"], "WhitespaceRule", "preserve");
opts = setvaropts(opts, ["VarName22", "VarName72", "VarName73", "VarName74", "VarName82"], "EmptyFieldRule", "auto");

% Import the data
ad = readtable("/Volumes/Data2/TaraEuropa/Partner_data/LOV/HyperBOOST_2023_pa_spectro_LOV.xlsx", opts, "UseExcel", false);


%% Clear temporary variables
clear opts

wl=ad.Station(3:503);
for i=2:101
    str_=['VarName',num2str(i)];
    B=eval(['ad.',str_]);
    spec(:,i-1)=B(3:503);
end

save LOV_ad spec wl
