matlab - Rounding to a power of 10 -


i have variable, taumax, want round up nearest power of ten(1, 10, 100, 1000...). using below expression find closest integer max value in tau array. finding max value because trying calculate power of ten should x axis cutoff. in cause, taumax equal 756, want have expression outputs either 1000, or 3(for 10^3).

taumax = round(max(tau)); 

i'd appreciate help!

since you're talking base 10, use log10 number of digits.

how about:

>> ceil(log10(756))  ans =       3 

Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

javascript - Iterate over array and calculate average values of array-parts -

jQuery Ajax Render Fragments OR Whole Page -