function [sampleN, sample, hours, minutes, seconds] =... readtextdata_eg_function(filename) fid = fopen(filename); %open file fgetl(fid); %Skip header line fgetl(fid); data = fscanf(fid,'%d %d:%d:%d %f',[5 10]); %read data fclose(fid); % close the file % now split the data into separate variables sampleN = data(1,:); hours = data(2,:); minutes = data(3,:); seconds = data(4,:); sample = data(5,:);