MATLAB Answers

How to create multiple .dat files using matlab?

5 views (last 30 days)
vigneshwaran K
vigneshwaran K on 20 Aug 2019
Commented: vigneshwaran K on 23 Aug 2019
Kindly assist me in creating multiple .dat files with the name of the variables in which the data file to be created.
Eg: For a=1:1:10, i need to create the dat file of .........._1.dat,........._2.dat, ......._3.dat, and upto ........_10.dat
Thank you in advance.

  1 Comment

vigneshwaran K
vigneshwaran K on 23 Aug 2019
I use to write the datas in dat files anfd i would like to close then i have to create the second dat file, writing the datas with particular variable(constant for each .dat files) and that constant value has to be attached as the name of the dat file.
For example, variale is 1,2,3,4,5. I have to create 1.dat then i ll write other x and corresponding y for that variable 1. then i have to close 1.dat . Then this process has to continue for the remain variables say 1,3,4,5. Dat files will be with the name of variable_1.dat , variable_2.dat. variable_3.dat. variable_4.dat. variable_5.dat

Sign in to comment.

Answers (1)

KSSV
KSSV on 20 Aug 2019
for i = 1:10
filename = strcat(num2str(i),'.dat')
end

  1 Comment

vigneshwaran K
vigneshwaran K on 23 Aug 2019
Thank you for your answer. But i use to write the datas in dat files anfd i would like to close then i have to create the second dat file, writing the datas with particular variable(constant for each .dat files) and that constant value has to be attached as the name of the dat file.
For example, variale is 1,2,3,4,5. I have to create 1.dat then i ll write other x and corresponding y for that variable 1. then i have to close 1.dat . Then this process has to continue for the remain variables say 1,3,4,5. Dat files will be with the name of variable_1.dat , variable_2.dat. variable_3.dat. variable_4.dat. variable_5.dat

Sign in to comment.

Sign in to answer this question.


Translated by