Merge multiple .txt files

3 vues (au cours des 30 derniers jours)
Ivan Mich
Ivan Mich le 19 Mai 2020
Modifié(e) : Stephen23 le 22 Mai 2020
I would like to merge multiple .txt files, and create ONE .txt file with the conte of all .txt files.
How could I do that?
  3 commentaires
Ivan Mich
Ivan Mich le 22 Mai 2020
for example for .csv files I use these commands in order to merge them together after each iterartion.
clc
clear
files = dir('*.csv') ;
N = length(files) ;
iwant = cell(N,1) ;
for i = 1:N
num = xlsread(files(i).name) ;
iwant{i} = num ;
end
iwant = cell2mat(iwant) ;
csvwrite('ALL.csv',iwant)
For .txt files what to do?
Stephen23
Stephen23 le 22 Mai 2020
Modifié(e) : Stephen23 le 22 Mai 2020
"For .txt files what to do?"
CSV files are text files.
What functions to use depends on the formatting of those text files, which you have not told us. You can select the functinos yourself here:

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Workspace Variables and MAT-Files dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by