How would I write this command?
이전 댓글 표시
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
the cyclist
2021년 3월 11일
This seems like homework. If you show us what you have tried so far, and ask a specific question, we can give you a hint. That is a good way to learn.
If you have no idea at all on how to get started, I suggest asking your instructor for help.
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
2021년 3월 12일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Timetables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!