MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# Automated Latex report of calculations: works in full Matlab, does not work in standalone ?

Asked by Steven on 12 Dec 2012
• Context: I developed a calculation tool for image processing. The program runs through a GUI. I made the tool available for my colleagues in other divisions worldwide by deploying the script to a standalone .exe-file.
• Goal: To be able to have an automated report print out of the results.
• How: I create a .tex-file in the script for this, using code like
     fid = fopen('Report.tex','w');
fprintf(fid,'%s\n','\documentclass{article}');
fprintf(fid,'%s\n','\begin{document}');
     ...%%%code to include the graphs and numbers saved in the Matlab-scripts
...%%%in the .TeX-code
fprintf(fid,'%s\n','\end{document}');
fclose(fid);
dos(['pdflatex Report -job-name='])
• Problem: This works perfectly when running the script in 'full' Matlab mode. IN STANDALONE MODE HOWEVER, the script does not manage to write the .TeX-script.
• Question: Does anyone know how to solve this ? Is there any specific measure I must take/package to load/.... in order to be able to write a .tex-file in standalone mode ?

Many thanks for any help !

## Products

No products are associated with this question.

Answer by Walter Roberson on 12 Dec 2012

Are you sure that it does not produce the file, but in a directory that you do not expect? The current directory for standalone executables is not the directory that you launch the executable from. You would be safer to use uiputfile() to have the user select the directory and filename.