printing char(177) to text file

1 回表示 (過去 30 日間)
Rakesh
Rakesh 2014 年 3 月 28 日
コメント済み: Rakesh 2014 年 3 月 31 日
I want to put +/- char(177) between the numbers x & y and save the output as text file.
x = [4 5 6];
y = x*0.8;
Using sprintf, I get the output on the command window:
sprintf(['%2.0f ' char(177) ' %1.2f\n'], [x;y])
But when I am using
fid = fopen('untitled.txt', 'w');
fprintf(fid, ['%2.0f' char(177) '%1.2f\n'], [x;y]);
fclose(fid);
I don't get +/- between the numbers.
  5 件のコメント
Niklas Nylén
Niklas Nylén 2014 年 3 月 28 日
Can you see the ± symbol if you open the txt file in the Matlab editor?
Rakesh
Rakesh 2014 年 3 月 31 日
no, I didn't see ± symbol when opened with Matlab editor too. However, it is working with previous ver. of Matlab in windows 7.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by