CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Use a txt file (X, Y, Z), with random values for X and Y, to get a new file X and Y

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By sbaffini

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2021, 11:54
Default Use a txt file (X, Y, Z), with random values for X and Y, to get a new file X and Y
  #1
New Member
 
Abdelhai
Join Date: Oct 2021
Posts: 2
Rep Power: 0
Benali.2 is on a distinguished road
I have a big 3D geometric txt file (X, Y, Z), about 50k lines, but it's not perfectly structured, I mean X and Y are picked at random. I want to create a new file based on the data of the first file, where the values of X and Y are predefined, so the program calculates the new values of Z, and then the program creates a new text file.
Thanks in advance!
Benali.2 is offline   Reply With Quote

Old   October 2, 2021, 12:27
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,014
Rep Power: 60
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
What do you want to do exactly? It's too vague.

Have you tried using a text editor or microsoft excel or well, anything?
LuckyTran is offline   Reply With Quote

Old   October 2, 2021, 12:41
Default
  #3
New Member
 
Abdelhai
Join Date: Oct 2021
Posts: 2
Rep Power: 0
Benali.2 is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
What do you want to do exactly? It's too vague.

Have you tried using a text editor or microsoft excel or well, anything?
I need how to write a simple Fortran or C++ program another programming language to read a txt file of 3 columns (x, y, z) and about 50k lines to create a new 3 column text file (x, y, z) with x and y predefined.

I used Microsoft Excel to sort in ascending or descending order...but because of the large number of lines it takes a long time

In another way, is there a possibility to find Z-values from a 3D representation (X, Y, Z) given constant values of X and Y as an iterative matrix?
Benali.2 is offline   Reply With Quote

Old   October 2, 2021, 13:00
Default
  #4
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 1,895
Blog Entries: 29
Rep Power: 36
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
If I understand what you mean, Octave and Matlab have sortrows, where you can instruct them to sort the rows of a matrix according to the columns of your choice in the order of your choice. Then you can write the output back to a txt file in the new order.
Benali.2 likes this.
sbaffini is offline   Reply With Quote

Reply

Tags
c++, fortran

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 08:46
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 03:23
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 11:44


All times are GMT -4. The time now is 11:02.