Forcing Page Breaks in MATLAB

99 visualizaciones (últimos 30 días)
James Long
James Long el 27 de Feb. de 2021
Comentada: Paul Hoffrichter el 28 de Feb. de 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?

Respuestas (1)

Paul Hoffrichter
Paul Hoffrichter el 27 de Feb. de 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 comentarios
James Long
James Long el 28 de Feb. de 2021
Editada: James Long el 28 de Feb. de 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 el 28 de Feb. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by