How to delete the header of the 1st line of .txt
Afficher commentaires plus anciens
Hello, I would like to ask a question. I have multiple .txt files that I want to merge in vertical manner. the format of these .txt files is the attached file
(1 header & 1 line with numbers)
I am using the commands:
clc
clear
filename1 = ['19*.txt'];%filename
fid_t=fopen(filename1,'r')
fid_p = fopen('final3.txt','w'); % writing file id
% if fid_p < 0, error('Cannot open file for writing.'); end
x = dir ('19*.txt');
for i = 1:length(x)
filename1 = x(i).name; %filename
fid_t = fopen(filename1, 'r');%open it and pass id to fscanf (reading file id)
if fid_t < 0, error('Cannot open file for reading.'); end
data = fread(fid_t, inf, '*char');%read data
fwrite(fid_p, data, 'char');%print data in File_all
fclose(fid_t);% close reading file id
end
but the point is that I would like not to take into account the headers of all the .txt files.
How can I make it?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import and Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!