How can i generate text file output for my code ?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
David Sanchez
2013 年 7 月 25 日
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);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!