Creare table in txt file
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
Good morning,
i have a problem with this simple code(i'm very noob):
x=[1,2,3,4,5];
y=[6,7,8,9,10];
p=fopen('risultato.txt', 'w');
fprintf(p,'%d\n\t%d\n',x,y);
fclose(p);
It writes
1
2
3
4
5
6
7
8
9
10
I want it writes
1 6
2 7
3 8
4 9
5 10
I tried to use the function table or cell2table but it gives me double error.
Thanks for your help
Antworten (2)
Friedrich
am 10 Jan. 2014
Hi,
try this:
p=fopen('risultato.txt', 'w');
fprintf(p,'%d\t%d\n',[x;y]);
fclose(p);
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!