System command calls different version of gdal

13 visualizaciones (últimos 30 días)
Adam Drake
Adam Drake el 19 de Mzo. de 2021
Comentada: Adam Drake el 19 de Mzo. de 2021
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.

Respuestas (1)

Sean de Wolski
Sean de Wolski el 19 de Mzo. de 2021
Editada: Sean de Wolski el 19 de Mzo. de 2021
Can you provide the full path to the gdal executable?
system('<gdalroot>/gdalinfo --version');
  1 comentario
Adam Drake
Adam Drake el 19 de Mzo. de 2021
>> 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

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by