Borrar filtros
Borrar filtros

Why is microservice able to load 'txt' files from subdirectory but not ".mat" files?

2 visualizaciones (últimos 30 días)
consider this function loadFile.m:
function w = loadFile()
w = 1;
Which I compiled using:
With options set to Include both files in subdirectory as 'Additional Files'. Then I compiled the function to a microservice using compiler.package.microserviceDockerImage.
The issue is - When I start the microservice as a docker container, the function is only able to read from the .txt file in the subdirectory, and not load the '.mat'. This Issue occurs only when loading mat file from subdirectory. if it is located in the same directory as function when compiling, loading is available when running as container.
I modified the DockerFile and rebuilt the image to make the script run as root, so I am confident this isn't a permissions issue.
The error message recieved in the http response:
"error":{"id":"MATLAB:load:couldNotReadFile","message":"Unable to find file or directory 'subdirectory\\someMatFile.mat'}

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 27 de Mzo. de 2024
Editada: Fangjun Jiang el 27 de Mzo. de 2024
Notice the two backslashes "\\" in the error message about the file?
"error":{"id":"MATLAB:load:couldNotReadFile","message":"Unable to find file or directory 'subdirectory\\someMatFile.mat'}
Does it make a difference between slash "/" and back slash "\"? Try to use
ans = 'subdirectory/someMatFile.mat'
ans = '/'
  1 comentario
Aran Ofer
Aran Ofer el 28 de Mzo. de 2024
Thanks, Error turned out to be a combination of path specification and partial inclusion of Additional Files at compilation.

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre COM Component Integration en Help Center y File Exchange.




Community Treasure Hunt

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

Start Hunting!

Translated by