# Thread: [SOLVED] While loop, array as a condition. Error

1. ## [SOLVED] While loop, array as a condition. Error

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.

2. syntax issue, needed to use {} instead of ()