MATLAB: Trouble getting a value of a keyword in a FITS file.

fitsfitsinfofitsreadkeywords

I have a FITS file named sun.fits. With fitsinfo('sun.fits'), the structure in the image below is output.
The Image header at the end contains the structure seen in the image below.
There is a specific keyword, 'EXPTIME', in the Keywords header at the end that contains a value that I want, as seen in the third image below.
fitsread('sun.fits', image) just images the data encoded in the DataType of the second image. I tried to find a way to access that specific keyword that I need in a script but couldn't find any. Of course, I can just double click on the Keywords and just find and see the value from there but I want to write code that returns it when I know the keyword that I'm looking for.
Thanks in advance, Chris

Best Answer

info = fitsinfo('sun.fits');
keywords = info.Keywords;
[tf, idx] = ismember('EXPTIME', keywords(:,1));
if tf
exposure_time = keywords{idx,2};
else
tf = nan;
end