When I set "doFields = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]", it generates forcing file with inaccurate values, especially for swflux and rain. The scale are about 20000 times higher and there are value < 0.
When I set doFields to a single number to generate a single file each time with "clear all" command in between, the files look good. I used absolutely the same input data.
I found it because the model kept blowing up, and super high fresh water flux was found in the middle of the ocean

Now I added a loop to change the single number of doFields, and "clear all" at the end of each loop. It works fine, but I still wonder why. Maybe something wrong with my parameter setting in the script or in matlab?
System: Linux mint 24.1
Matlab: 2021b
The d_ecmwf2roms.m is attached. Please check. Thank you so much.