I am very new to matlab (started yesterday), so I might be doing something very obviously wrong.
I am trying to work through increments of 0.1 to 4 in 0.1 steps, and count the number of results in another array (called 'p_11_10') that are less than each increment, and then output these results to an array.
When I run the code without trying to output to an array I can see the calculation is working correctly, but when I put the last line in, I get the error:
'Index in position 1 is invalid. Array indices must be positive integers or logical values'
for i = increments y = (sum(p_11_10 < i)/total_n)*100 m(i,:) = y end
increments is defined earlier in the code (because we might want to change it) as:
low_thick = 0.1;high_thick = 4.0;incre_thick = 0.1; increments = low_thick:incre_thick:high_thick;
I watched some videos and read some of the responses on this website with similar looking problems, and that is where the 3rd line of the top block comes from.
I'm guessing this is something to do with how I'm indexing through the loop, but I'm not sure.
Any help would be much appreciated.
Best Answer