Info
此问题已关闭。 请重新打开它进行编辑或回答。
Searching for file 'X' in all the subfolders and combining data of all X
1 次查看(过去 30 天)
显示 更早的评论
I am trying to combine results from a simulation. The simulation results file contains 40 sub folders for different time steps. For example first folder is for time_0, second folder is for time_1 likewise I have 40 folders. Each folder contains results of 60 parameters in 60 files(Temperature, pressure, etc.,). Each file is 2d table. So if you look at temperature results file, it contains temperature data for particular x & y. Now I need to take all temperature results files from different time step and combine it to make it as 3d table. So previously the temperature is based on x & y but now it's based on time also which converts it to 3d. Now I need to create 3d table for all the parameters and from that I need to create time vs that parameter graph.Could someone please hep me out with this?.
Currently I am doing the below mentioned things.
Read all the files in a folder
mat = dir('*.csv');
for q = 1:length(mat)
load(mat(q).name);
end
The above program helping me in reading all the .csv file in a particular folder.
Loading a file from the subfolder
filetofind = 'Wall_Temperature1.csv';
dirinfo = dir();
dirinfo(~[dirinfo.isdir]) = []; %remove non-directories
tf = ismember( {dirinfo.name}, {'.', '..'});
dirinfo(tf) = []; %remove current and parent directory.
numsubdir = length(dirinfo);
lastmod = inf(numsubdir,1);
for K = 1 : numsubdir
load(fullfile(dirinfo(K).name, filetofind));
end
This one helps me in loading the particular file from all sub folders.
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!