Filter löschen
Filter löschen

Exciting latex file using Matlab giving errors

3 Ansichten (letzte 30 Tage)
Diana Dawoud
Diana Dawoud am 9 Jul. 2022
Beantwortet: dpb am 9 Jul. 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

Antworten (1)

dpb
dpb am 9 Jul. 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.

Kategorien

Mehr zu MATLAB Report Generator finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by