How to create multiple .dat files using matlab?

2 次查看(过去 30 天)
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 个评论
vigneshwaran K
vigneshwaran K 2019-8-23
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

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2019-8-20
for i = 1:10
filename = strcat(num2str(i),'.dat')
end
  1 个评论
vigneshwaran K
vigneshwaran K 2019-8-23
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by