Effacer les filtres
Effacer les filtres

Exciting latex file using Matlab giving errors

1 vue (au cours des 30 derniers jours)
Diana Dawoud
Diana Dawoud le 9 Juil 2022
Réponse apportée : dpb le 9 Juil 2022
I have the following code
setenv('PATH', [getenv('PATH') ':/Library/TeX/texbin/pdflatex']);
setenv('PATH', [getenv('PATH') ':/X/Y/Documents/L.tex']);
command = 'pdflatex /X/Y/Documents/L.tex';
[status,cmdout] = system(command)
and I'm getting the following error
status =
127
cmdout =
'zsh:1: command not found: pdflatex
I got the path of /Library/TeX/texbin/pdflatex from typing "which pdflatex" using the terminal.
Any idea why I'm getting this error

Réponses (1)

dpb
dpb le 9 Juil 2022
The system function uses a shell program and spawns a new process in which the command is executed; hence, the environment seen in the new shell is brand new and environment settings from the executing shell in which MATLAB is running are not inherited/seen in the new shell.
You can set environment variables by executing chained commands or using batch file that does the needed background work before launching the executable.
There's more info at system in the "More About" section.

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by