arrange columns side by side using matlab
1 回表示 (過去 30 日間)
古いコメントを表示
Hii experts, i have 5000 .txt file in a directory that contains single column data. i want to arrange them side by side seqentially to make a mxn matrix file.
My files serial number starts from 1.txt 2.txt.....5000.txt
I tried from here https://in.mathworks.com/matlabcentral/answers/260839-how-to-place-multiple-csv-files-along-coloum-side-by-side-in-a-single-file but not get success.Please suggest a better solution.Thanks.
2 件のコメント
回答 (1 件)
Scott MacKenzie
2021 年 7 月 3 日
編集済み: Scott MacKenzie
2021 年 7 月 3 日
n = 5000; % number of files to read
basefilename = 'temp'; % change as necessary
M = []; % preallocate if you know the number of values in each file
for i=1:n
f = [basefilename num2str(i) '.txt'];
if isfile(f) % verify file exists (as a precaution)
M(:,i) = readmatrix(f);
end
end
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!