Re: How to read a csv file? [message #86194 is a reply to message #86175] |
Thu, 17 October 2013 05:44  |
galaxytraveler42
Messages: 5 Registered: October 2013
|
Junior Member |
|
|
Thank you! Those where the magic words that unlocked my data.
On Wednesday, October 16, 2013 4:52:43 PM UTC+2, Mats Löfdahl wrote:
> Den onsdagen den 16:e oktober 2013 kl. 16:46:44 UTC+2 skrev galaxytr...@gmail.com:
>
>> I have tried using the read_csv command:
>
>>
>
>> data = read_csv(path+'filename.csv',HEADER=SedHeader)
>
>>
>
>> and it it seems to work:
>
>> Help, data:
>
>> ** Structure <2161e08>, 28 tags, length=5600, data length=5600, refs=1:
>
>> FIELD01 STRING Array[20]
>
>> FIELD02 STRING Array[20]
>
>> FIELD03 DOUBLE Array[20]
>
>> FIELD04 DOUBLE Array[20]
>
>> FIELD05 DOUBLE Array[20]
>
>> .... (I have shortend it here)
>
>>
>
>> print, SedHeader
>
>> id full_name diameter H extent ...
>
>>
>
>> Now I would like to have the different columns in the csv out in individuel arrays. But here is my problem, what is the command?
>
>>
>
>> I have tried without luck:
>
>> print, diameter
>
>>> %PRINT: Variable is undefined: DIAMETER.
>
>> print, field03
>
>>> % PRINT: Variable is undefined: FIELD03.
>
>> col3=data(3, *)
>
>> print, col3
>
>>
>
>>> % Attempt to subscript DATA with <INT ( 3)> is out of range.
>
>>
>
>> What is the magic word?
>
>
>
> I have never used read_csv but the fact that the data is a structure suggests that this should do it:
>
>
>
> print,data.field03
|
|
|