execution of external program fails

조회 수: 6 (최근 30일)
Matthias Pospiech
Matthias Pospiech 2012년 3월 4일
I call ghostscript with
cmd = [gs ' -sOutputFile="' outputFile '" -f "' inputFile '"'];
status = system(cmd); % Run Ghostscript.
which results in commands like this one:
gswin32c.exe -q -dSAFER -dNOPAUSE -dBATCH -dEPSCrop -dUseFlateCompression=true -dAutoRotatePages=/None -dHaveTrueTypes -r600 -dGraphicsAlphaBits#4 -dTextAlphaBits#4 -sDEVICE=png16m -sOutputFile="C:\SVN\google code\latexfigure\trunk\example\TEMP9058.png" -f "C:\SVN\google code\latexfigure\trunk\example\TEMP9058.pdf"
This is valid code an works in the command windows of windows. But matlab comlains:
Der Befehl "gswin32c.exe" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
The 'gswin32c' is in the path of windows and I restarted matlab already. What could go wrong?

답변 (2개)

Daniel Shub
Daniel Shub 2012년 3월 4일
There is something wrong with the path when you run system. MATLAB doesn't use the same path as the Windows command window. You need to add the full path to gswin32c.exe.
  댓글 수: 2
Matthias Pospiech
Matthias Pospiech 2012년 3월 4일
The full path is the most unwanted solution, although obvious.
The whole code worked on other computers, so I need to know what to fix.
And if matlab handles the path different than windows I need to know how.
Daniel Shub
Daniel Shub 2012년 3월 5일
If you look at export_fig Oliver hard coded the paths. It might be unwanted, but it is probably the best you can do.

댓글을 달려면 로그인하십시오.


Oliver Woodford
Oliver Woodford 2012년 3월 8일
I suggest you use the ghostcript function that comes with export_fig. It uses a full path if it needs to, but sets it automatically on each pc. You will also need to include the user_string function too.

카테고리

Help CenterFile Exchange에서 Direction of Arrival Estimation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by