function [data, time_stamps] = radFileParser_2(fileName) % Created by Katie Harrington (kharring@mit.edu) July 2011 % WARNING: This code has been know to throw errors if you have % mode 1 and mode 4 measurements in the same file. % It will work for mode 1 or mode 4 if the file contains only % that mode. % % filename is the location of the .rad file % ex: 'data/galaxy_scan.rad' % % data is a matrix containing every column of the rad file Except the % 1st column (the time stamp of the scan). Each row of the matrix is a % seperate scan % % time_stamps is a column vector containing the time stamps from each % scan newData1 = importdata(fileName); %vars = fieldnames(newData1); textdata = newData1.textdata; data = []; time_stamps = []; index = 1; for i = 1:size(textdata,1) %go through file line by line if textdata{i,1}(1) == '*' %if the line is a comment continue; end time_stamps = cat(1, time_stamps, textdata{i,1}); data = cat(1, data, nan(size(textdata(i,2:end-1)))); for n = 2:length(textdata(i,1:end-1)); data(index,n-1) = str2double(textdata{i,n}); end index = index + 1; end end