Home > data-utility > get_csv_headers.m

get_csv_headers

PURPOSE ^

header lines should begin with a #

SYNOPSIS ^

function [out, i] = get_csv_headers(csv)

DESCRIPTION ^

 header lines should begin with a #
 i returns the line where the data should begin

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [out, i] =  get_csv_headers(csv)
0002 % header lines should begin with a #
0003 % i returns the line where the data should begin
0004 
0005 out = cell(20,1);
0006 i = 1;
0007 
0008 fid = fopen(csv, 'r');
0009 line = fgetl(fid);
0010 while strcmp('#', line(1))
0011     out{i,1} = line;
0012     i = i + 1;
0013     line = fgetl(fid);
0014 end
0015 fclose(fid);
0016 
0017 out(cellfun(@isempty, out)) = [];
0018 end

Generated on Tue 23-May-2017 20:00:55 by m2html © 2005