how to consider only the integer part discarding the exponent part
2 ビュー (過去 30 日間)
古いコメントを表示
Suppose i have a= [1 23 56]*10^(-9);
i want to acccess only the integer part that is 1 23 and 56.
i want to find the max(a). That is the output should be 56.
0 件のコメント
回答 (2 件)
Star Strider
2023 年 6 月 2 日
編集済み: Star Strider
2023 年 6 月 2 日
This appears to be a reasonably robust approach —
a = [1 23 56]*10^(-9);
b = a.*10.^ceil(-log10(abs(a))+1)
max_a = max(b)
a = [1 23 56]*10^(-6);
b = a.*10.^ceil(-log10(abs(a))+1)
a = [1 23 56]*10^(10);
b = a.*10.^ceil(-log10(abs(a))+1)
a = [1 23 56]*10^(-1);
b = a.*10.^ceil(-log10(abs(a))+1)
EDIT — Corrected typographical error
.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!