Effacer les filtres
Effacer les filtres

Forcing Page Breaks in MATLAB

47 vues (au cours des 30 derniers jours)
James Long
James Long le 27 Fév 2021
Commenté : Paul Hoffrichter le 28 Fév 2021
When working in the Live Editor, can I insert command lines that will force the output to start a new page when exporting to PDF?

Réponses (1)

Paul Hoffrichter
Paul Hoffrichter le 27 Fév 2021
The official 2016 answer is here, and no discernible updates since 2016. It would be great if MathWorks would add that to Live Editor.
If you have the report generator, it is possible, but not directly in Live Scripts.
Conceivably, by dividing your Live Script into separate PDF files, there may be a way to use the report generator to read each PDF file, and append a page break.
Or, you could use the idea from here to insert a "\f" (but you would have to know where to insert it - you could add a known string, but this is all very klugy, and still not guaranteed to work).
I tried the fprintf approach printing out some text and ending it with \f\n. The text came out fine with a single line break, but no form feed. Then I tried ending the text with \f\f\f\f\f\\n\n\n\n\n\n\n\n\n\n, but Live Editor carefully removed all paper feed special chars, and the PDF results were identical.
Looks like you have to purchase their Report Generator Toolbox to get professional reports. I looked at its user manual, which is 1660 pages long. It references Live Editor:
You can use the MATLAB Report Generator to create reports for sharing your MATLAB code
and presenting the results of the code.
In addition, MATLAB provides several methods for presenting MATLAB code and results, including:
• Live Editor (MATLAB)
• MATLAB publish command
The MATLAB Live Editor enables you to create cohesive, shareable documents that include
executable MATLAB code, embedded output, and formatted text.
No further references or integration with Live Editor is mentioned.
  2 commentaires
James Long
James Long le 28 Fév 2021
Modifié(e) : James Long le 28 Fév 2021
Appreciate the response, Paul! I also played around with the fprintf command using the \f\n controls and experienced the same results as you (or should I say non-results?). Perhaps that will be a future enhancement to the Live Editor capabilities.
Paul Hoffrichter
Paul Hoffrichter le 28 Fév 2021
I would not hold my breath waiting. This feature is in their report generator product and it appears that there is intentional suppression of line and page controls in live edit.

Connectez-vous pour commenter.


En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by