MATLAB: Check for the existence of a variable inside a structure array

exist

I have a structure array:
data{1} =
date: 19580508
lon: 159.3833
lat: -23.4667
depth: [12x1 single]
temp: [12x1 single]
sal: [12x1 single]
oxy: [12x1 single]
Some of them have the variable 'oxy', others don't. I am trying to figure out how to check for the existence of 'oxy'.
I tried to use A = existence('data{1}.oxy'), but its results are always 0, even when the variable exists.
Should I use some other function to achieve this? Thanks!

Best Answer

any(ismember(fields(data{1}),'oxy'))