EDITED QUESTION:
I have 2500 rows x 100 columns seismic data in variable named avg_seismic_data_models. I also have 2500 rows x 100 columns variable 'X' and similar size matrix variable 'Y', both containing the co-ordinates. I want to save the values of this variable in a text (.dat) file which must have 302 header lines in the following manner:
avg_seismic_data_models
300
X_1
X_2
.
.
.
X_100
Y_1
Y_2
.
.
.
Y_100
avg_seismic_data_models_1
avg_seismic_data_models_2
avg_seismic_data_models_3
.
.
.
.
.
avg_seismic_data_models_100
In the above header style, the first line is the name of the file, the 2nd line tells the number of columns (each column has 2500 rows), and the rest of the 300 lines represent the model of each variable respectively - Like 100 models of X, 100 models of Y and 100 models of avg_seismic_data_models.