CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Importing XYZ data from .csv file.

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   December 8, 2010, 11:21
Default Importing XYZ data from .csv file.
  #1
New Member
 
Edmund Leung
Join Date: Dec 2010
Posts: 2
Rep Power: 0
mtledmund is on a distinguished road
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
mtledmund is offline   Reply With Quote

 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 06:43.