Dataset loop and iteration
1 次查看(过去 30 天)
显示 更早的评论
Hi, i have a problem with file.txt loop. I have to plot a series of datasets in different files (60). Is it possible to iterate the same procedure for each file in order not to define 60 variables? each dataset have different rows and columns numbers. Is it possible?
1 个评论
Kaushik Lakshminarasimhan
2018-1-17
Yes, you need to create an a array of filenames and then use it to load them one by one. You don't have to manually define the array, you can use the dir function.
采纳的回答
KSSV
2018-1-18
files = dir('*.txt') ; % all the text files in the folder
N = length(files) ; % Total number of files
% loop for each file
for i = 1:N
thisfile = files(i).name ;
% load the file
% do what you want
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!