How can i generate text file output for my code ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I want to generate text file as output..
eg. G0 X67 Y30 Z0 G1 X0 Y0 Z0
i have numbers (67, 30 ,0...) stored in cell i want to add characters like X,Y Z and G and store the result as text file.. Can anyone help? Thanks in advance.
0 comentarios
Respuesta aceptada
David Sanchez
el 25 de Jul. de 2013
To add/concatenate letters and numbers:
my_char = 'A';
my_number = 50;
my_string = strcat(my_char,num2str(my_number));
To save data to .txt file:
x = 0:.1:1;
A = [x; exp(x)];
fileID = fopen('exp.txt','w');
fprintf(fileID,'%6s %12s\n','x','exp(x)');
fprintf(fileID,'%6.2f %12.8f\n',A);
fclose(fileID);
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!