first off here is the error,

??? Function 'gt' is not defined for values of class 'cell'.

Error in ==> insertionsort at 7

while (j > 0) && (A(j) > key)

It happens when I try to set any kind of array value as a condition for a loop.

Code:

while (j > 0) && (A(j) > key)
end

Of course I have full code but that is where the error lies. If I was the say output A(1) it will output just fine so my array is ok.

gt is the greater than function in matlab, I am assuming it does not like arrays? If so how can I get around this? documentation is no help.