Re: csv file read

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 25 2012 - 19:09:50 MDT

Chao,

Try str_split_csv function
http://www.ncl.ucar.edu/Document/Functions/Built-in/str_split_csv.shtml

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Sep 25, 2012, at 5:02 PM, Luo, Chao wrote:

> 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

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

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