フィルターのクリア

Matrix number format not a double

1 回表示 (過去 30 日間)
Philosophaie
Philosophaie 2014 年 2 月 8 日
コメント済み: Walter Roberson 2014 年 2 月 9 日
I need to format not with a double :
number * 2^(integer)
but with a base 10 format :
floatingpointnumber * 10^(integer)
or
(floatingpointnumber)E(integer)
for i=1:4
for j=1:4
for k=1:4
Affinity(i,j,k)=double(subs(Affinity0(i,j,k),{r,h},{rr,theta}))
end
end
end

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 2 月 8 日
fprintf('%.10e %.10e %.10e %.10e\n', Affinity)
or
format f
disp(Affinity)
  2 件のコメント
Philosophaie
Philosophaie 2014 年 2 月 9 日
In need something to replace "double" that will show floating point numbers. Just a word.
Walter Roberson
Walter Roberson 2014 年 2 月 9 日
double() already creates the values as floating point numbers. When you use double() the internal storage will be IEEE 754 Binary Floating Point "double", 64 bit.
Anything like floatingpointnumber * 10^(integer) is a matter of display not of storage. I have shown you two different ways to change the display.
However, as long as you do not initialize your Affinity matrix to a floating point number such as 0, then you can convert your value to a symbolic number that would display the way you are looking for. To do that, change double() to vpa(). Note that the values so created will look as if they are normal MATLAB arithmetic values but will instead be symbolic numbers.

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

カテゴリ

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