This should be solvable keeping my generic solution to this problem in mind.
1) Run the code with dbstop if error
It will now stop at the line that you provided:
outclass= glevels(outclass(~unClassified),:);
2) Check the possible solutions.
In this case I assume that glevels
and outclass
are both
variables. The next thing to do would be to carefully examine
everything that could be an index.
Starting inside out:
- The first index is
~unClassified
, as the~
operation did not fail, it is safe to say that this is now a logical vector. - The second and lastindex is
outclass(~unClassified)
, this one is most likely not consisting of only numbers like 1,2,3,... or true,false values.
The test whether the values are all valid is quite simple, one of these two should hold:
- To confirm that the values in
x
are logical:class(x)
should return 'logical' - To confirm that the values in
x
are real positive integers:isequal(x, max(1,round(abs(x))))
should return 'true'.