CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Use a txt file (X, Y, Z), with random values for X and Y, to get a new file X and Y (https://www.cfd-online.com/Forums/main/238776-use-txt-file-x-y-z-random-values-x-y-get-new-file-x-y.html)

Benali.2 October 2, 2021 11:54

Use a txt file (X, Y, Z), with random values for X and Y, to get a new file X and Y
 
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!

LuckyTran October 2, 2021 12:27

What do you want to do exactly? It's too vague.

Have you tried using a text editor or microsoft excel or well, anything?

Benali.2 October 2, 2021 12:41

Quote:

Originally Posted by LuckyTran (Post 813437)
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?

sbaffini October 2, 2021 13:00

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.


All times are GMT -4. The time now is 10:35.