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

2 ビュー (過去 30 日間)
sani ars
sani ars 2012 年 6 月 8 日
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??..

回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 6 月 8 日
Change it to
fprintf(fid,'\n');
  1 件のコメント
sani ars
sani ars 2012 年 6 月 9 日
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

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by