Display Format for Numeric Value in Matlab

I have just interpolated a time-series data to fill the missing values in Matlab. The function interp1 did that task well, but I did not like the number format which was not in ordinary form. (See how to interpolate in Matlab)

Since I wanted to copy the result to Excel worksheet, the result format was difficult to capture. But Matlab provides the format function for converting a number format into another (see Matlab official site). To see the available format, come into Matlab help by typing help format in command window. Here is the format with the result samples:

1. Format SHORT (Scaled fixed point format with 5 digits)

2. Format LONG (Scaled fixed point format with 15 digits for double and 7 digits for single)


3. Format SHORTE (Floating point format with 5 digits)


4. Format LONGE (Floating point format with 15 digits for double and 7 digits for single)


5. Format SHORTG (Best of fixed or floating point format with 5 digits)


6. Format LONGG (Best of fixed or floating point format with 15 digits for double and 7 digits for single)


7. Format SHORTENG (Engineering format that has at least 5 digits and a power that is a multiple of three)


8. Format LONGENG (Engineering format that has exactly 16 significant digits and a power that is a multiple of three)


Hmm, I prefer to use no. 6, FORMAT LONGG, because it is easy to understand. However, the other might be better, it depends on your computation problem.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s