How to find minimum element from an array.

function to find Minimum element of an element. Ex: There is an array ArrCost , having elements 132 784 94 35 567. I have to find minimum number from it, but Min(ArrCost) is not Working. Is there any another function.

2 件のコメント

Adam
Adam 2014 年 11 月 3 日
編集済み: Adam 2014 年 11 月 3 日
What do you mean by "not working"?
min
is obviously the function that does what you say so you need to be more specific as to what is not working about it.
>> ArrCost = [132 784 94 35 567]
ArrCost =
132 784 94 35 567
>> min( ArrCost )
ans =
35
priyanka
priyanka 2014 年 11 月 3 日
Index exceeds matrix dimensions.
Error in PrimsAlgo (line 298) min( ArrCost ) This is the error.

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

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 3 日

0 投票

a=[132 784 94 35 567]
b=min(a)

5 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 3 日
Priyanka commented
Index exceeds matrix dimensions.
Error in PrimsAlgo (line 298) min( ArrCost ) This is the error.
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 3 日
Check if min is not used as a variable in your code
priyanka
priyanka 2014 年 11 月 3 日
No min is not used as variable. Still same problem.
James Tursa
James Tursa 2014 年 11 月 3 日
What do you get when you type in
which min
priyanka
priyanka 2014 年 11 月 3 日
Its working. Thank you

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2014 年 11 月 3 日

コメント済み:

2014 年 11 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by