sorry .. I made a mistake in writing the code
The correct version is:
(I recreated an exercise with the number of numbers of my work..this is a
test to show you that I can't run it for memory)
error: out of memory or dimension too large for Octave's index type
error: called from
prova2 at line 8 column 4
i used unint16..but the result is the same..:(
if i try this code with B=50 it runny perfectly
ok, since it runs for B=50 and you've avoided looping, it seems you've managed to solve the problem as you first presented it. there are numerous computer algorithms that will work perfectly well for certain data sizes but require completely different approaches for 'big data'.
Perhaps you could share the actual problem you're trying to solve. I feel like we could keep proposing an infinite number of suggestions that would lead you in the wrong direction if we don't understand what it is that the homework is trying to teach you. Is the goal to work on code vectorization, to manage large dataset problems, etc. While we don't want to solve the actual problem for you, we should be able to provide more useful guidance.