csv file read

From: Luo, Chao <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 25 2012 - 17:02:53 MDT

Hi,

I am trying to read csv format file by NCL script, and want to print out the certain column in the file. There is a problem, when I print out certain column, since some row has component like "abc,edf", and some row not ("abcedf") . If there is any way to count component in the quotation mark as one (ignore command in the quotation mark). The script I used is like:

------------

begin
filename = "../dat/2012-MarApr-fire.csv"

;---Read in file as array of strings so we can parse each line
lines = asciiread(filename,-1,"string")

delim = ","

cy = str_get_field(lines,12,delim)

asciiwrite("fire.txt",cy)

end
-----------

Thanks,

CL

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 25 17:03:02 2012

This archive was generated by hypermail 2.1.8 : Wed Sep 26 2012 - 13:56:03 MDT