Matlab 2012: bug in 2012 implementation of Max() !???

2 ビュー (過去 30 日間)
Amir
Amir 2012 年 3 月 13 日
Try to to this:
max([1 2 5 2])
it then says:
Index exceeds matrix dimensions.
however for min([1 2 5 2]) or even mean([1 2 5 2]) there is no problem and they work fine.

回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 3 月 13 日
This is because you have defined a variable by the name max:
whos max
and to fix it:
clear max
and then rename your variable something else (maybe the_max)
  1 件のコメント
Jan
Jan 2012 年 3 月 13 日
An evergreen.
Try this:
clear('max')
max(1:5)
max = rand(1, 5);
max(1:5)

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

カテゴリ

Help Center および File ExchangeText Analytics Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by