Handling profile files with matlab
Hello,
I am searching for a Matlab code, which can re-sort the profile files that are written by Fluent. Fluent typically writes all the values (e.g. x-, y- and z coordinate, x-,y- and z-vel.) in one series one after another. I want to have them as a matrix, if possible as numerical format (integer). Thanks in advanced Ralf |
Re: Handling profile files with matlab
Hello,
I am proud to present the matlab code I have developed. The comments are in German, but it is not so difficult to understand. But there is still a problem: It work fine with a self written sample file, but not with the original fluent code! The columns have different length!!!!! Where is the Problem??? See also http://www.cfd-online.com/Forum/fluent.cgi?read=29319 can someone help me?? Ralf ______________ clear all; sim_quellpfad = 'D:\Ralf\Simulation\'; % Pfad des Verzeichnisses in dem die Dateien stehen sim_zielpfad = 'D:\Ralf\Simulation\'; sim_daten_name = 'Geometrie_02_x-395' ; % Name der Fluent Datei sim_dateiname = [sim_quellpfad sim_daten_name '.txt']; sim_daten01 = fopen(sim_dateiname,'r'); % Laden der Fluent Datei L_S = 1930; % Anzahl der Werte in einer Datei for k = 1:2 % die ersten 3 Zeilen der Datei sind der "header", die Zeilen werden gelesen und ignoriert fgets(sim_daten01); end for j = 1:7 % Auswertung für 7 Werte (x-, y- und z-koordinate, vx, vy, vz und vel.mag.) for i = 1:L_S sim_datenXXa = fscanf(sim_daten01, '%f', 1); % mit fscanf wird eine neue Datei erstellt (nach dem ersten Wert wird ein Zeilenumbruch gemacht) sim_datenXX(i,j) = sim_datenXXa; % die Werte werden in eine Matrix geschrieben end for k = 1:3 % die folgenden 2 Zeilen sind der "header", die Zeilen werden gelesen und ignoriert fgets(sim_daten01); end end fclose(sim_daten01); |
Re: Handling profile files with matlab
Hallo Ralf,
ich schicke Dir mal eine Funktion aus einem meiner Programme. Damit lassen sich auch die Werte mehrerer Ebenen innerhalb einer Profildatei auslesen. Die einzelnen Spalten müssen eigentlich immer genauso lang sein. Dirk |
Re: Handling profile files with matlab
Hi!
I solved the problem: The data were damaged due to the SSH client I used for getting the data from the workstation with Fluent running on to my PC. The SSH Client transfer mode was "auto-select" and in this mode, some part of the data were cut. Now it is "binary" and it workes fine! Ralf |
All times are GMT -4. The time now is 09:51. |