hi there so i'm about to return to uni and so i thought id brush up on my ole matlab skills before returning so i went back to basics. at the moment im going through previous exams and the question issued was.
(b) (15 marks) Write a matlab script which counts the number of primes less than or equal to an integer n, say, where $n=2,3,...,1000$ and stores the result in an array count(n).
for e.g. count(7) would take the value 4 as there are four primes (2,3,5,7) less than or equal to 7
so heres my code (im not actually being tested so im being a bit lenient at this stage)
sooo i have it accurately telling me the number of primes between 1 and n at least so far as i can tell. but it's not storing A,
now i assume (like i said, im quite rusty at this and it's taking longer than id like) that the reason why its not storing A is because im running a function and i'm missing a "store vector A for later use" command.
Further i know i could technically get around this by making it actually a script (like it asks admittedly) with a few inputs and prompts to do the same thing as a function but you know....learning and stuff.
any help would be greatly appreciated.


[0 cumsum(isprime(1:n))]should do the job – N74 Sep 06 '17 at 19:18"...less than or equal to 7. Your script should also plot the values of count(n) against n as a line and, on the same graph include a plot of n/log(n)"
Which is why i was asking for the return on the array. again my apologies to everyone, after all how can you answer a question if i dont give enough information...i'll also post the finish product for reference.
– Vaas Sep 06 '17 at 19:45