Clean it up from successive calculation
2 ビュー (過去 30 日間)
古いコメントを表示
I have an array and I want to clean it up from successive calculation:
for i=1
for j=1:4
for k=1:4
B(i,j,k)=double(A(i,j,k))
end
end
end
A is a 4x4x4 matrix and contain a diversity of numbers from 1E-9 to 1E+9.
I need a format other than "double" to show all the decimal places 0.0000000001 and all the zeroes 1000000000.
Or could you send me a link of all the formats like "double".
0 件のコメント
回答 (1 件)
Iain
2014 年 2 月 13 日
Data formats tell you what the data represents. Doubles are actually the best, commonly used, method to store signed numbers with amplitudes between 10^-300ish to 10^300ish.
It looks like you want to store or display the numeric values, as strings.
To store them, you can explicitly use sprintf, with the correct c-style string notation to return the values in a string format that has the correct amount of precision.
To display them you can explicitly use fprintf/sprintf, with the correct c-style string notation to return the values in a string format that has the correct amount of precision. Or, you can change matlab's default way of displaying numbers to "long" (though, that only handles up to 8 significant figures).
If you can't get the numbers into a string using those methods, in the format you want, you can, with the right intelligence, write a function to take a number and return it as you want.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!