EDITED QUESTION:
I have 2500 rows x 100 columns data in variable named avg_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_data_models
300
X_1
X_2
.
.
.
X_100
Y_1
Y_2
.
.
.
Y_100
avg_data_models_1
avg_data_models_2
avg_data_models_3
.
.
.
.
.
avg_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_data_models.
Consider this code:
EDIT
It seems I misunderstood the question.. Here’s the code to write the actual data (not the header titles!):
Note: I used a comma
,as delimiter, you can change it to be a spaceor a tab\tif you like..