Azzera filtri
Azzera filtri

save as ascii files

23 visualizzazioni (ultimi 30 giorni)
harley
harley il 4 Ago 2013
how to i make 2 columns in the text file i get 1 continuous column for variables Vb & pH.
fid = fopen('gc_test.txt', 'wt');
fprintf(fid, '%4.4f\n', Vb, pH);
fclose(fid);

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 4 Ago 2013
Modificato: Azzi Abdelmalek il 4 Ago 2013
fid = fopen('gc_test.txt', 'wt');
fprintf(fid, '%4.4f\n', [Vb;pH]);
fclose(fid);
If you want two columns
Vb=[1;2;3];
pH=[4;5;6];
fid = fopen('gc_test.txt', 'wt');
fprintf(fid, '%4.4f %4.4f\n',[Vb,pH]' );
fclose(fid);
  3 Commenti
harley
harley il 4 Ago 2013
works, thanks very much Azzi.
regards
Azzi Abdelmalek
Azzi Abdelmalek il 4 Ago 2013
A={0.0500 0.7557 ;0.1000 1.0567}
header={'Vb' 'pH'}
fid = fopen('gc_test.txt', 'wt');
fprintf(fid,'%s %s\n',header{:})
fprintf(fid, '%4.4f %4.4f\n',A{:} );
fclose(fid);

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Large Files and Big Data in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by