フィルターのクリア

How can I replace roundn?

5 ビュー (過去 30 日間)
FPMONT
FPMONT 2015 年 7 月 22 日
コメント済み: Star Strider 2015 年 7 月 22 日
My Matlab version is R2014a, I need a replacement for the function roundn that was common in the matlab previous versions, but not more recognized for the 2014 version. Part of my code is: drawLine([0 roundn(max(z1),2)+100], [0 min(z1)]); hold on; ps: z1 is 2601x1double

採用された回答

Star Strider
Star Strider 2015 年 7 月 22 日
MATLAB has always had a round function, recently incorporating the functionality of roundn from the MApping Toolbox.
You can create your own version with this anonymous function:
roundn = @(x,n) 10.^n .* round(x/10.^n);
It produced the same answer for the same input as the example in the documentation for it when I tested it, so it should be a seamless replacement.
  2 件のコメント
FPMONT
FPMONT 2015 年 7 月 22 日
Thank you Star Strider, the code is fixed!
Star Strider
Star Strider 2015 年 7 月 22 日
My pleasure!

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by