Effacer les filtres
Effacer les filtres

Writing a live script that contains return-statements. Exported PDF empty and cannot be opened.

1 vue (au cours des 30 derniers jours)
I've been trying to Write a Live script for electronic exam purposes (teaching the use of MATLAB), that contains return-statements that prevent the script from progressing further if intermediate variable assignments are incorrect. The input inspectons are currently done using multiple p-files that return true or false depending on the value of the variables entered by the student (whether a variable is an integer or a specific vector, for example).
I'm wondering whether the use of return-statements is preventing the Live script from being exported to PDF, since whenever I attempt it the resulting PDF is empty and cannot be opened. I'm guessing MATLAB attempts to run the file during the export process and fails to do that because of the return-statements.
If this is how the system is implemented, I'm going to have to rethink how I do this.
  2 commentaires
Santtu Söderholm
Santtu Söderholm le 6 Juin 2018
I tried removing all of the return-statements and the file runs just fine without any errors, but I still get an empty PDF-file when trying to export. I'm now thinking the problem might be elsewhere...
Santtu Söderholm
Santtu Söderholm le 6 Juin 2018
Tried to export the same file on a Windows machine and it worked flawlessly. There is clearly a problem with either my MATLAB-installation (MAC) or something else just isn't working on my computer.

Connectez-vous pour commenter.

Réponse acceptée

Prajit T R
Prajit T R le 11 Juin 2018
Hi Santtu
This issue was reported earlier for MAC devices and there are workarounds to get around this:
1. Try increasing the Java heap size and see if you are able to successfully able to export to PDF then. Instructions for doing so are on this page: https://www.mathworks.com/help/matlab/matlab_external/java-heap-memory-preferences.html
2. Try converting to PDF from the command line using the following command (make sure you are in the same folder that your live script is saved in, and replace 'myscript.mlx' and 'mypdf.pdf' with the names of your files):
>> matlab.internal.liveeditor.openAndConvert('myscript.mlx','mypdf.pdf')
Hope this helps.
Prajit
  1 commentaire
Santtu Söderholm
Santtu Söderholm le 11 Juin 2018
Modifié(e) : Santtu Söderholm le 11 Juin 2018
This was indeed the solution. Now, how do I accept an answer on this forum?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by