问题描述:

I want to insert the symbol +- (\pm) between x and y in table created in matlab

x = (1:1:5)';

y = x*5/100;

table = [x y]

So, that the output is

1.0000 +/- 0.0500

2.0000 +/- 0.1000

3.0000 +/- 0.1500

4.0000 +/- 0.2000

5.0000 +/- 0.2500

If we can also write the minus exactly below plus.

网友答案:

With output as a text file use the format spec for fprintf such as

FileID=fopen('FileName.txt','w');

fprintf(FileID,['%1.4f ',177,' %1.4f\n'],[x';y'])
网友答案:

fprintf(['%0.2f ' char(177) ' %0.2f\n'], [x;y])

相关阅读:
Top