Azzera filtri
Azzera filtri

Exciting latex file using Matlab giving errors

1 visualizzazione (ultimi 30 giorni)
Diana Dawoud
Diana Dawoud il 9 Lug 2022
Risposto: dpb il 9 Lug 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

Risposte (1)

dpb
dpb il 9 Lug 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.

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by