System command calls different version of gdal

조회 수: 13 (최근 30일)
Adam Drake
Adam Drake 2021년 3월 19일
댓글: Adam Drake 2021년 3월 19일
I am importing .hdf files programatically and need to perform some combinations and transformations using gdal. When I do these commands from terminal (Ubuntu 20.04.2) they run fine. When I use the same command in matlab using system() I get an ERROR 4: file.hdf not recognized as a supported file format. When I check for acceptable formats using the --formats tag hdf4 and hdf5 appear in terminal but not in the Matlab system command. I then checked versions using the --versions tag and found that in terminal I get:
~$ gdalinfo --version
GDAL 3.0.4, released 2020/01/28
~$ which gdalinfo
/usr/bin/gdalinfo
In MATLAB command window I get:
>> system('gdalinfo --version');
GDAL 3.0.2, released 2019/10/28
>> system('which gdalinfo');
/usr/bin/gdalinfo
I have gone through steps to completely delete gdal from my system and confirmed that both terminal and command window return that gdal is not a command and then reinstalled but the same issue appears. I have checked the PATH variable in MATLAB and it says usr/bin is in the path. If anyone can help I would greatly appreaciate it.

답변 (1개)

Sean de Wolski
Sean de Wolski 2021년 3월 19일
편집: Sean de Wolski 2021년 3월 19일
Can you provide the full path to the gdal executable?
system('<gdalroot>/gdalinfo --version');
  댓글 수: 1
Adam Drake
Adam Drake 2021년 3월 19일
>> system('/usr/bin/gdalinfo --version');
GDAL 3.0.2, released 2019/10/28
In Terminal:
~$ /usr/bin/gdalinfo --version
GDAL 3.0.4, released 2020/01/28

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by