How to read and arrange certain data in multiple text file?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I need to arrange the data after post-proceesing in text file and need to arrange the data in certain order. I only need the numerical part of the data. Any suggestion to solve this problem?
Attached herewith 3 text file of the data.
0 件のコメント
採用された回答
Bhaskar R
2020 年 3 月 11 日
FAM_data = readmatrix('FAM.txt');
FCC_data = readmatrix('FCC.txt');
FM2_data = readmatrix('FM2.txt');
5 件のコメント
Bhaskar R
2020 年 3 月 11 日
This part works for you
FAM_data = readmatrix('FAM.txt');
FCC_data = readmatrix('FCC.txt');
FM2_data = readmatrix('FM2.txt');
% OR horizantal concatanation
FAM_data(:,1 = []; % remove first and coulmn as it has NaN values and only 0's
FCC_data(:,1) = []; % remove first and coulmn as it has NaN values and only 0's
FM2_data(:,1) = []; % remove first and coulmn as it has NaN values and only 0's
total_data = [FAM_data ;FCC_data ;FM2_data ]; % horizantal concatanation
% write data to excel file
writematrix(total_data, 'file_name.xlsx');
その他の回答 (1 件)
Peter O
2020 年 3 月 11 日
編集済み: Peter O
2020 年 3 月 11 日
This seems like a good opportunity to leverage MATLAB's table datatype:
Use readtable() to import your data and writetable() to spit it out in the correct column ordering (adding/removing columns as needed. Within writetable, if you specify the name-value pair "WriteVariableNames" and false, the output file will not contain the headers.
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!