Subject to some questions being omitted, I would like to mention the following points:
I understand that the variable amistad is a vector of 296x1 elements, then, it is incorrect to initialize the variable amistad in that way, given that you have not previously defined it (of course, unless you have a class definition) or function that returns a matrix of those dimensions, which I do not know now). The appropriate thing would be to use the zeros function to initialize a vector of zeros that you will fill in as necessary, that is:
amistad = zeros(296,1);
Now, there is something that seems to me somewhat "unusual" in your code: why do you "manually" modify the value of the variable i ?. Normally a cycle variable does not modify it, you can use it to operate with it, but not modify it. In this case, the value of your cycle variable will always be the same: the one assigned to variant , and therefore you will always be "filling in" the same position, which is absurd since you do not need a loop for this.
Another point you should review is regarding your condition if , would not it be better to check if the number in question is even or odd, instead of explicitly placing the numbers?.