Filter löschen
Filter löschen

how to delete column from text file without loading it into a matrix first

1 Ansicht (letzte 30 Tage)
I have the code as follows:
fid = fopen('5_prcnt_noised_iono_train_data.txt','w+');
for i = 1:Ntrain_data
fprintf(fid,'\n%6.2f',noised_train_data(i));
for j = 1:Nof_noised_train_feat
fprintf(fid,'\t%6.2f',noised_train_data(i,j));
end
end
in this , I have write the train data into a text file from train_data matrix.... The problem is, when writing the data in the text file,it also print an extra first column in the start of each row....and I don't want this extra first column....
I have to delete that column but the format of fprintf func does not allow me to do this.....
There is need to make change in the 3rd line of code:
fprintf(fid,'\n%6.2f',noised_train_data(i));
this syntax add an extra first column in each row.....
how to fix it??..

Antworten (1)

Walter Roberson
Walter Roberson am 8 Jun. 2012
Change it to
fprintf(fid,'\n');
  1 Kommentar
sani ars
sani ars am 9 Jun. 2012
but when I open the text file it doesn't show me the next row in new line it continues to the same row.. Although, when I open this text file via MATLAB editor it shows me the next row in new line correctly....
I also wants the same with when I open the text file without MATLAB editor.............
Actually, I have to use this text file further in my code so, I need to keep the data in an arranged format

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Text Analytics Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by