%% Raw Data conversion from .mat to .csv % Ella Guy % Last Updated: 29MAY2023 clear all, close all, clc % Load Data %-------------------------------------------------------------------------- % Inputs------------------------------------------------------------------- for SubjectNumber = 1:80 % de-identifyed subject number %-------------------------------------------------------------------------- %-------------------------------------------------------------------------- %% Raw BOB_infile_format_raw = 'PQ_rawData/Subject%d_raw.mat'; BOB_infile_raw = sprintf(BOB_infile_format_raw, SubjectNumber); load(BOB_infile_raw) % BOB_infile_raw: % 'time' - time [s] % 'GaugeP_ADC' - Gauge pressure % 'InhaleP_ADC' - Inspiratory differenrtial pressure % 'ExhaleP_DC' - Expiratory differenrtial pressure % 'Chest_counts' - Chest circumference % 'Abd_counts' - Abdominal circumference % 'Depth_chest' - Chest crossectional depth [mm] % 'Width_chest' - Chest crossectional width [mm] %% csv_outfile_format_raw = 'PQ_rawData/Subject%d_raw.csv'; csv_outfile_name_raw = sprintf(csv_outfile_format_raw, SubjectNumber); Output_raw = zeros(length(time), 8); Output_raw(:,1) = time; Output_raw(:,2) = GaugeP_ADC; Output_raw(:,3) = InhaleP_ADC; Output_raw(:,4) = ExhaleP_ADC; Output_raw(:,5) = Chest_counts; Output_raw(:,6) = Abd_counts; Output_raw(1,7) = Depth_chest; Output_raw(1,8) = Width_chest; OutputTable_raw = array2table(Output_raw); OutputTable_raw.Properties.VariableNames(1:8) = {'Time [s]', ... 'Gauge Pressure', 'Inspiratory differenrtial pressure', 'Expiratory differenrtial pressure', ... 'Chest circumference', 'Abdominal circumference', ... 'Chest crossectional depth [mm]', 'Chest crossectional width [mm]'}; writetable(OutputTable_raw, csv_outfile_name_raw) writetable(OutputTable_raw, csv_outfile_name_raw) %% With Processed Units BOB_infile_format = 'PQ_rawData/AprilTrial2023_Subject%d.mat'; BOB_infile = sprintf(BOB_infile_format, SubjectNumber); load(BOB_infile) % BOB_infile_raw: % 'time' - time [s] % 'GaugeP' - Gauge pressure [cmH2O] % 'InhaleDeltaP' - Inspiratory differenrtial pressure [cmH2O] % 'ExhaleDeltaP' - Expiratory differenrtial pressure [cmH2O] % 'Chest' - Chest circumference [mm] % 'Abd' - Abdominal circumference [mm] % 'Depth_chest' - Chest crossectional depth [mm] % 'Width_chest' - Chest crossectional width [mm] %% csv_outfile_format = 'PQ_rawData/Subject%d.csv'; csv_outfile_name = sprintf(csv_outfile_format, SubjectNumber); Output = zeros(length(time), 8); Output(:,1) = time; Output(:,2) = GaugeP; Output(:,3) = InhaleDeltaP; Output(:,4) = ExhaleDeltaP; Output(:,5) = Chest; Output(:,6) = Abd; Output(1,7) = Depth_chest; Output(1,8) = Width_chest; OutputTable = array2table(Output); OutputTable.Properties.VariableNames(1:8) = {'Time [s]', ... 'Gauge Pressure [cmH2O]', 'Inspiratory differenrtial pressure [cmH2O]', 'Expiratory differenrtial pressure [cmH2O]', ... 'Chest circumference [mm]', 'Abdominal circumference [mm]', ... 'Chest crossectional depth [mm]', 'Chest crossectional width [mm]'}; writetable(OutputTable, csv_outfile_name) writetable(OutputTable, csv_outfile_name) end