我如何从1.4795e + 004转到14795.00? [英] How do I go from 1.4795e+004 to 14795.00?

查看:78
本文介绍了我如何从1.4795e + 004转到14795.00?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个困扰我很长时间的问题..我想更改数字的格式..不知道怎么办?我已经尝试了帮助文件,但找不到答案.

I have this problem that has been bothering me for quite a while.. I want to change the format of the number.. Don`t know how? Ive tried the help files but can't find the answer.. If you can help me please do..

推荐答案

在谈论数字的格式"时,您可能要指的是三种不同的东西:显示格式,内存中的变量存储格式(即数据类型/类)以及数据文件中的存储格式.我会给每个人发短信...

There are three different things you could potentially be referring to when you talk about the "format" of a number: the display format, the variable storage format in memory (i.e. the data type/class), and the storage format in a data file. I'll address each...

  • 显示格式:如

  • Display format: As already mentioned by Amro, the display format can be adjusted with the FORMAT command. However, this only affects how the numbers are displayed, not how they are stored in memory.

变量类型/类:有许多

Variable types/classes: There are a number of numeric classes, both floating point and signed/unsigned integer types, that variables can use. By default, MATLAB variables are stored as double-precision floating point numbers. To convert to other types, you can use the variable type as a function to recast a value. For example, a = uint8(0); converts 0 to an 8-bit unsigned integer type and stores it in a, while b = single(pi); converts the value pi into single-precision and stores it in b.

文件存储格式:在将数值读/写到文件时,文件的类型会影响文件的存储方式.二进制文件(使用 FWRITE 和 FREAD )存储的完整二进制表示形式一个数字,因此可以将其表示为与变量作为变量(双精度,单精度,8位整数等)存储在内存中的类型完全相同的类型.

File storage format: When reading/writing numeric values to files, the type of file affects how it will be stored. A binary file (written to and read from using FWRITE and FREAD) stores the complete binary representation of a number, and can thus represent it as exactly the same type as it is stored in memory as a variable (double-precision, single-precision, 8-bit integer, etc.).

或者,使用 FPRINTF FSCANF 其他功能)将以字符串格式存储值,该值必须在将值输出到文件时指定.您可以指定精度数字以及格式(例如指数符号或十六进制). FPRINTF 的文档指定了这些输出格式. /p>

Alternatively, a text file (written to and read from using FPRINTF and FSCANF, among other functions) will store a value in a string format that you must specify when outputting the values to the file. You can specify the digits of precision, as well as the format (such as exponential notation or hexadecimal). The documentation for FPRINTF specifies these output formats.

这篇关于我如何从1.4795e + 004转到14795.00?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆