Well, since you did write a fair amount of code, homework or not is irrelevant. There are some issues with your code however.
First, it seems silly to test numbers for primality using isprime as you did. If you intend to do that, then just use primes(6000) in the first place to generate the list of primes.
Next, this is silly
if length(A) > 100; A = A(1:100); end
A = reshape(A, 10, 10);
Think about it. What will you do if length(A) is LESS than 100? Your code will fail anyway, since the reshape will fail. Therefore, you might as well replace the above code with
A = reshape(A(1:100),10,10);
Better yet, if you have the symbolic toolbox which provides the function nthprime, you could simplify your code nicely. Note my use of mod to generate the last digit. As well, see that you can specify the size of the final array.
primearraysize = [10,10];
A = primes(nthprime(prod(primearraysize)));
A = reshape(A,primearraysize);