I am trying to sub-array in MATLAB with no luck.
This is what I am doing:
a = randint(latticeSize, 1, [0 1]);
% a 1st attempt which works but sucks
localPattern = [a(i-1) a(i) a(i+1)];
The above works fine but I want to generalize it with something like:
% this is how I'd like to do it as more general
localPattern = a(i-1 : i+1);
Is there any difference between the two? A display shows the same result but if I use the different alternatives in my code I get very different results (I get what I want with the 1st one).
In case the rest of the code is needed I can provide it, but if someone can spot something just looking at the above then there's no need.