# MATLAB2HD script

**URL:** <https://forums.nlr.gov/t/matlab2hd-script/2104>\
**Category:** Computer-Aided Engineering Software Tools\
**Created:** [August 8, 2019, 2:42pm UTC](https://forums.nlr.gov/t/matlab2hd-script/2104 "2019-08-08T14:42:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlie.Sheng](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Charlie.Sheng](https://forums.nlr.gov/u/Charlie.Sheng)\
**Post date:** [August 8, 2019, 2:42pm UTC](https://forums.nlr.gov/t/matlab2hd-script/2104/1 "2019-08-08T14:42:25Z")

</div>

Dear all,

I am using the MATLAB script to generate the new HydroDyn input files with the modified certain parameters. but I got problem, and here to seek for help, my code is as followings:

% HydroDyn input file  
Hrefer=‘C:\Users\Desktop\FAST\_MATLAB\OC4TC\5MW\_Baseline\NRELOffshrBsline5MW\_OC4DeepCwindSemi\_HydroDyn.dat’;  
HydroS = HD2Matlab(Hrefer,2); % this contains 2 header lines  
% Wave seed  
WaS=randi([-2147483648,2147483647],1);  
HydroS = SetFASTPar(HydroS,‘WaveSeed(1)’,WaS);  
%Hs  
Hs=12;  
HydroS = SetFASTPar(HydroS,‘WaveHs’,Hs);

Hrefer1=‘C:\Users\Desktop\FAST\_MATLAB\OC4TC\5MW\_Baseline\NRELOffshrBsline5MW\_OC4DeepCwindSemi\_HydroDynCS.dat’;  
Matlab2HD(HydroS,Hrefer,Hrefer1,2); % there are 2 header lines

while I got the error from the MATLAB as follows:

WARNING: ! not found in the HD data structure. Default value listed below (from template file, C:\Users\Desktop\FAST\_MATLAB\OC4TC\5MW\_Baseline\NRELOffshrBsline5MW\_OC4DeepCwindSemi\_HydroDyn.dat) will be used instead:  
Columns 1 through 13

20.0000 0.6300 0.6300 0 0 0 0 0 0 0 0 0 0

Columns 14 through 21

```
     0 0 0 0 0 0 0 0

```

WARNING: ! not found in the HD data structure. Default value listed below (from template file, C:\Users\Desktop\FAST\_MATLAB\OC4TC\5MW\_Baseline\NRELOffshrBsline5MW\_OC4DeepCwindSemi\_HydroDyn.dat) will be used instead:  
Columns 1 through 13

21.0000 0.6300 0.6300 0 0 0 0 0 0 0 0 0 0

Columns 14 through 21

```
     0 0 0 0 0 0 0 0

```

…

I try to recheck the code many times, while still cannot figure out what is the problem. Any help would be appreciated!

Best regards,  
Charlie

---

<div class="post-metadata">

**Author:** ![Bonnie.Jonkman](https://dub1.discourse-cdn.com/nrel/user_avatar/forums.nlr.gov/bonnie.jonkman/32/3230_2.png) [@Bonnie.Jonkman](https://forums.nlr.gov/u/Bonnie.Jonkman)\
**Post date:** [October 16, 2019, 10:44pm UTC](https://forums.nlr.gov/t/matlab2hd-script/2104/2 "2019-10-16T22:44:23Z")

</div>

Hi, Charlie.

I am not exactly sure what the problem is, but the warning message indicates that it thinks there is a variable called “!” in the template that has a value of “20.0000 0.6300 0.6300 0 0 0 0 0 0 0 0 0 0”. Perhaps it’s not reading a table correctly?

Do you get this problem if you use this template: [github.com/OpenFAST/matlab-tool … droDyn.dat](https://github.com/OpenFAST/matlab-toolbox/blob/master/ConvertFASTversions/TemplateFiles/HydroDyn.dat)

---

<div class="post-metadata">

**Author:** ![Charlie.Sheng](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Charlie.Sheng](https://forums.nlr.gov/u/Charlie.Sheng)\
**Post date:** [October 18, 2019, 9:03pm UTC](https://forums.nlr.gov/t/matlab2hd-script/2104/3 "2019-10-18T21:03:23Z")

</div>

Hi Bonnie,

I figure out the problem. Yes, you are right, when using MATLAB2HD script to modify the parameters in template HydroDyn input files, the ‘!’ cannot be read by the script. With all ‘!’ being deleted, the matlab script will work successfully.

Thanks,  
Charlie
