MATLAB: Having Issues with ‘>’ operator not working on matrix elements.

helplogical operatorMATLAB

I am having an issue when using the '>' operator in one of my scripts, for lack of better phrasing it doesn't seem to work in certain cases.
I have a matrix that contains multiple pieces of data, and then I wish to compare two of the elements against each other. When I do this it always returns a logical 0. I have successfully used this operator in many other places and it works just fine.
An example of this is as follows:
>> temp_para(2)
ans =
3.5251e+03
>> temp_para(1)
ans =
6378
>> temp_para(2) > temp_para(1)
ans =
logical
0
I have tried to get around this issue by assigning the values to separate variables and then comparing those new variables against each other but that doesn't work either. I have also tried replacing the
temp_para(2) > temp_para(1)
with
gt(temp_para(2),temp_para(1))
and it still returns a logical 0.
Does anyone have any idea what is causing this or how to get around this? Any help would be appreciated.

Best Answer

temp_para(2) is negative and temp_para(1) is positive. If you want to compare their magnitudes, compare the abs of those two quantities.