How would I write this command?

8 ビュー (過去 30 日間)
Ryan Williams
Ryan Williams 2021 年 3 月 11 日
コメント済み: Ryan Williams 2021 年 3 月 12 日
Write MATLAB commands that computes the maximum prime number in a matrix.
I tried
function MaxPrime = MaxPrime(A)
MaxPrime = max(isprime(A));
disp(MaxPrime)
end
got an error because one of my integers was negative. please help
  3 件のコメント
David Hill
David Hill 2021 年 3 月 11 日
primes cannot be negative by my definition, but if you wanted to ignore the negative, then
max(A(isprime(abs(A))));
Ryan Williams
Ryan Williams 2021 年 3 月 12 日
Appreciate the help!

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by