用于 HDF 数据的 Matlab 批处理给出了错误。如果我使用单一操作,它会完美运行。但不能批量操作。我的代码在这里
files = dir('/upload/server/php/files/*.hdf');
for k = 1:numel(files)
L_865 = hdfread(files(k).name, '/Geophysical Data/L_865', 'Index', {[1 1],[1 1],[6120 1243]});
L_620 = hdfread(files(k).name, '/Geophysical Data/L_620', 'Index', {[1 1],[1 1],[6120 1243]});
NDVI = (L_865- L_620) ./ (L_865 + L_620);
NDVI=NDVI-min(NDVI(:));
NDVI=NDVI./max(NDVI(:));
[J,~]=gray2ind(NDVI);
imwrite(J,jet,['/server/php/files/images/'files(k).name],'jpg');
end
错误是
Error using hdfread>dataSetInfo (line 348)
Could not open file 'OxxxST_S.hdf'.
Error in hdfread (line 209)
[hinfo,params] = dataSetInfo(varargin{:});
Error in batchndvi (line 7)
L_865 = hdfread(files(k).name, '/Geophysical Data/L_865', 'Index', {[1 1],[1 1],[6120
1243]});