MATLAB: A function to find prime number

functionprime numbertoo many output arguments

Hello,
I wrote a function to find a prime number and would like to run it to find all prime numbers up to 100 from my starting point. However, I get an error saying "too many output arguments".
Here is what I have…
function isPrime(number)
tf=isprime(number);
if tf==true
disp(number)
end
end
starting_point=input("Enter your number: ");
while starting_point<100
disp(isPrime(starting_point))
starting_point=starting_point+1;
end
I would really appreciate if anyone can help me with this problem….

Best Answer

Your function doesn't return anything, so when you try to use its output you get an error. Change this:
function isPrime(number)
to this
function tf = isPrime(number)