필터 지우기
필터 지우기

Exciting latex file using Matlab giving errors

조회 수: 1 (최근 30일)
Diana Dawoud
Diana Dawoud 2022년 7월 9일
답변: dpb 2022년 7월 9일
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

답변 (1개)

dpb
dpb 2022년 7월 9일
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.

카테고리

Help CenterFile Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by