|
[Sponsors] |
December 8, 2010, 11:21 |
Importing XYZ data from .csv file.
|
#1 |
New Member
Edmund Leung
Join Date: Dec 2010
Posts: 2
Rep Power: 0 |
Hello everyone,
I have a .csv file in the following format: 400,5000,600 500,6000,400 400,5000,990 All the variables are separated with a comma. I want to open the csv file with perl and then create points with all the x y z from that file. So far, I have done the following: ! $data_file = "myfile.csv"; # Defining the data file name. ! open my $HANDLE, $data_file; # Opening the data file #! @pts_data = (<HANDLE>); # Storing all the data in an array "pts_data" ! foreach (<my $HANDLE>) ! { ! my @file_line = split(/\t/,$_); ! $x_coor = $file_line[0]; ! $y_coor = $file_line[1]; ! $z_coor = $file_line[2]; #! ($x_coor, $y_coor, $z_coor) = split (/\,/,$_); # Set coordinates from file, xyz splitted by a comma (,). # Then I create the point, I skipped the section for the post. !} !close ($HANDLE) Can someone please tell me what's wrong with it? Thanks. Edmund |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extract data we want from Techplot to a data file | vetnav | Main CFD Forum | 0 | July 28, 2010 20:17 |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |
[OpenFOAM] Paraview command not found | hardy | ParaView | 7 | September 18, 2008 04:59 |
Compiling OpenFOAM13 on AMD64 with Redhat Enterprise | mbeaudoin | OpenFOAM Installation | 20 | June 17, 2008 06:43 |
Saving particle (DPM) data to file? | Philip | FLUENT | 2 | June 12, 2006 01:41 |