How do I open a .raw file so that it can be viewed as a table?

1 view (last 30 days)
Cole Garabed
Cole Garabed on 14 Jan 2022
Edited: Cris LaPierre on 17 Jan 2022
I have this .raw file that I would like to open in as a table so I can then further process the data. I currently have to open the file using excel and then import the excel file as a table into matlab, but I want to cut out that step. (Also, I have code written to clean up the table once it's in matlab, so I'm not worried if the import has a bunch of NaN values). I can't attach the .raw file becase matlab doesn't support the format so I'm attaching the excel file.
%% Import data and convert excel file to a struct
% Input the .xlsx file in the function below
T = readtable('OS-1-69-B1-HT.is_comp.xlsx');
% Rectify and organize data
row_valid = ~reshape(ismissing(T(:,1)), 1 , []);
starts = strfind([false row_valid], [false true ]);
stops = strfind([row_valid, false], [true false]);
sub_tables = arrayfun(@(B,E) T(B:E,:), starts, stops, 'uniform', 0);
% Convert the table to a struct
Data = struct();
for i = 1:length(sub_tables)
Data.(sprintf('Specimen%d',i)) = sub_tables{i};
end

Accepted Answer

Cris LaPierre
Cris LaPierre on 15 Jan 2022
Edited: Cris LaPierre on 17 Jan 2022
Consider starting with this:
T = readtable("OS-1-69-B1-HT.is_comp.raw",'Delimiter',{'"',','},...
'FileType','text','numHeaderLines',94)
Add your code, and it appears the result is the same (though not checked exhaustively)

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!