フィルターのクリア

how to get matrix value right?

3 ビュー (過去 30 日間)
anika hossain
anika hossain 2015 年 8 月 15 日
編集済み: Stephen23 2015 年 8 月 17 日
i am working on transferring some values to a matrix from another one. when i am printing the results individually like new(1,1) its showing exact result, but when printing whole new its giving totally wrong answer with (1.0e+003 *) on above.how to solve the problem?
new(row,col)=newMatrix(l,k,m); disp(new(1,1));-gives right answer but- disp(new); gives all wrong.

採用された回答

Stephen23
Stephen23 2015 年 8 月 15 日
編集済み: Stephen23 2015 年 8 月 17 日
Actually MATLAB is displaying the correct values, but they are simply being displayed using scientific notation. Scientific notation is a very common convenient way to write large/small numbers, without using lots of digits. Lets have a look at some simple examples:
>> 1000000000 % one with nine zeros
ans =
1.0000e+09
>> 1e9 % easier to input it like this
ans =
1.0000e+09
And if the values are in an array, then a common exponent is placed above the displayed values (it becomes a factor of all of the values displayed in the array below it):
>> [1e9,2e10]
ans =
1.0e+10 *
0.1000 2.0000
This is the correct behavior, not an error. You can find more information about scientific format on the the internet. If you want to change how the values are displayed, then have a look at format, and try some of the options until you find one that you like:
>> format longG
>> [1e9,2e10]
ans =
1000000000 20000000000
Note that the docs suggest that shortG might be suitable for data that has a wide range of values.
  1 件のコメント
anika hossain
anika hossain 2015 年 8 月 15 日
Thanks,it was very helpful...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by