简体   繁体   English

MATLAB如何在没有科学/指数表示法的情况下将值存储在变量中?

[英]MATLAB how to store Value in Variable without scientific/exponential notation?

I've got a Matrix, let's say x, that contains seven values in exponential notation. 我有一个矩阵,比方说x,它包含七个以指数表示法的值。 Next i want to write this Variable to a textfuile, but without the exponential but with a decimal notation. 接下来,我想将此变量写入textfuile,但不使用指数,但使用十进制表示法。

I tried str2num(num2str(exportdata, '%15.4f')); 我尝试了str2num(num2str(exportdata, '%15.4f')); and fprintf but this only works for displayed data but not for storage as far as I know. fprintf但据我所知,这仅适用于显示的数据,不适用于存储。

You can use fprinf to print directly to the file. 您可以使用fprinf直接打印到文件。 For example: 例如:

v = [173524132746354.21542, 987678898521232.32547]

fid = fopen('file.txt','w')
fprintf(fid, '%0.2f, %0.2f', v)
fclose(fid)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM