How would I write this command?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
David Hill
am 11 Mär. 2021
primes cannot be negative by my definition, but if you wanted to ignore the negative, then
max(A(isprime(abs(A))));
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!