Clean it up from successive calculation
조회 수: 4 (최근 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에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!