フィルターのクリア

How can i reduce precision only in the maximum value of a column matrix?

1 回表示 (過去 30 日間)
EM geo
EM geo 2019 年 2 月 19 日
回答済み: Naman Bhaia 2019 年 2 月 28 日
I would like to reduce the precision only to the maximum value of my matrix D3 (attached). All the values are with 4 decimals but i want the maximum with only two decimals, rounded down.
Thanks in advance
  1 件のコメント
madhan ravi
madhan ravi 2019 年 2 月 20 日
format bank
but in that way i modify all the values of the matrix, i need to modify only the maximum value of this matrix and leave the others unmodified.

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

回答 (1 件)

Naman Bhaia
Naman Bhaia 2019 年 2 月 28 日
Hey Elisa,
The max() function returns the maximum value in an array and its index position. So using the following command we get the maximum value of the array ‘slope1’ into the variable ‘a’ and its index position in variable ‘b’.
[a b] = max(slope1);
After finding the index position you can use the round() function to round off that particular value using the following command:
slope1(b)=round(slope1(b),2);

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by