Loop for editing editing values in .dat file
Show older comments
Dear all,
I am trying to write a script for automatically changing values into a .dat file,which is contained into a folder. Part of the .dat file is given below. . What I want to do, is to create a loop, where for each iteretation, the folder is copied and the .dat file in each copied folder is opened, and the value "ExampleValue" is assigned into a specific value for every iteration. My idea is the following. The folder is copied via the copyfile command. Then, the file is opened via fopen,read via fread, the string is replaced with the value I want via strrep and the the file closes via fclose and the loop continues. However, I have issues in reading the file. The file should be read line by line, without any format change. Does anyone have any idea on how to make the commands work?Or any other direction for reading the file?
Best Regards,
Ioannis Voultsos.
------- InflowWind v3.01.* INPUT FILE -------------------------------------------------------------------------
IEA 15 MW Offshore Reference Turbine
---------------------------------------------------------------------------------------------------------------
True Echo - Echo input data to <RootName>.ech (flag)
5 WindType - switch for wind file type (1=steady; 2=uniform; 3=binary TurbSim FF; 4=binary Bladed-style FF; 5=HAWC format; 6=User defined)
0 PropagationDir - Direction of wind propagation (meteoroligical rotation from aligned with X (positive rotates towards -Y) -- degrees)
0 VFlowAng - Upflow angle (degrees) (not used for native Bladed format WindType=7)
1 NWindVel - Number of points to output the wind velocity (0 to 9)
0.0 WindVxiList - List of coordinates in the inertial X direction (m)
0.0 WindVyiList - List of coordinates in the inertial Y direction (m)
150.0 WindVziList - List of coordinates in the inertial Z direction (m)
================== Parameters for Steady Wind Conditions [used only for WindType = 1] =========================
"ExampleValue" HWindSpeed - Horizontal windspeed
Accepted Answer
More Answers (1)
Ioannis Voultsos
on 23 Jan 2022
0 votes
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!