How to save results with greek letters for importing into publish command

5 ビュー (過去 30 日間)
S H
S H 2019 年 5 月 24 日
コメント済み: madhan ravi 2019 年 5 月 24 日
showing data with greek letters in Matlab command window interface has no problem. The following code is an example:
fprintf(['coordinate = ','%0.2e \x',num2str(dec2hex(8737)),'%0.2f \x',num2str(dec2hex(186)),'\n'],10,pi)
I want to save the outputs of my scripts that has greek letters into a file. If I use fopen and fclose such as:
fid=fopen('filename');
fprintf(fid,['coordinate = ','%0.2e \x',num2str(dec2hex(8737)),'%0.2f \x',num2str(dec2hex(186)),'\n'],10,pi);
fclose(fid);
greek letters are not shown properly by the text editor and the saved file cannot be used later.
My question: How can I save the results with greek letters shown in Matlab command window interface to a file so that I can load them later into publish command and create a report from the outputs of my scripts.

回答 (1 件)

madhan ravi
madhan ravi 2019 年 5 月 24 日
Z=sprintf('coordinate = %0.2e %s %0.2f %s',...
10,char(8737),pi,char(186));
writetable(table({Z}),'sample.txt',...
'WriteVariableNames',0)
  4 件のコメント
S H
S H 2019 年 5 月 24 日
Thank you Madhan. Still char(8737) doesn't show properly. It is probably because of an issue with utf-8 encoding that I do not know how to fix.
madhan ravi
madhan ravi 2019 年 5 月 24 日
Neither do I sorry.

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

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by