function [TimeData, LabelData, Labelnames] = platereaderread3(filename,outputpath) %====================== % Barry Canton, March 2006 %====================== %Check the input file format [prefix fileformat]=strtok(filename,'.'); if fileformat='txt' % This code reads a results text file that is output by the Victor 3 % plate reader. It expects that there are only two labels being % measured, the first of which is absorbance, the second is % fluorescence. the start of the text file should look like this - %Plate Repeat Well Type Time OD600 (A) Time GFP-separated (Counts) %1 1 F01 M 00:00:26.27 0.076 00:00:51.68 977 %1 1 F02 M 00:00:26.59 0.069 00:00:52.04 914 % %There is extra data at the bottom of the results text file but once the format is %no longer as that shown above, this code will stop reading. %====================== fid=fopen(fullname); header = fgetl(fid); columnnames = textscan(header,'%s \t','whitespace','\t'); basic = '%n %n %s %s'; labelstring = '%s %n '; numberoflabels = (length(columnnames{1,1})-4)/2; labels = repmat(labelstring,1,numberoflabels); Labelnames = columnnames{1,1}(6:2:6+((numberoflabels-1)*2)); format = strcat(basic,blanks(1),labels); C = textscan(fid,format); fclose(fid); %Extract the useful information from the data - Repeats = C{2}; Wells = C{3}; Time = C{5}; LabelData = C(6:2:6+((numberoflabels-1)*2)); LabelData = cell2mat(LabelData); %====================== %Wells %====================== %Work out the well indices (a1, b2 etc.) and store them in a string array WellNames = unique(Wells); WellNames = cell2mat(WellNames); %====================== %Time %====================== %Process the time mins, starting from 0 TimeVec = datevec(Time); TimeSerial = datenum(TimeVec); %change time format TimeData = TimeSerial*24*60;%convert to mins TimeData = TimeData-TimeData(1); %set the start time to 0mins elseif fileformat='csv' C = csvread(filename,1,0); %Extract the useful information from the data - Repeats = C(:,2); Time = C(:,3); LabelData = C(:,4:2:end); % LabelData = cell2mat(LabelData); %====================== %Time %====================== %Process the time into mins, starting from 0 TimeData = Time*24*60; end %find one time point for each repeat. This gets the last time point %recorded for each repeat, use that as the single time point for each label %and for each well. [Steps, index, junk] = unique(Repeats); TimeData = TimeData(index); Repeats = length(Steps); %====================== %Labels %====================== %Rearrange both of the data arrays so that each well has its own column. %This will fail if for some reason all wells don't have the same number of %repeats, for example, if you terminate the plate reader while its %measuring wells. If so you should use the loop that is commented out %below. %Repeats = max(Repeats); %find the number of repeats LabelData = reshape(LabelData,[size(LabelData,1)/Repeats,Repeats,2]); LabelData = permute(LabelData,[2,1,3]); %====================== %Save data %====================== %Save the processed data to a .mat file if nargin ==2 location = strcat(outputpath,filename); else location = strcat(filename); end save(location,'TimeData','LabelData','Labelnames');