Forcing Page Breaks in MATLAB

조회 수: 100 (최근 30일)
James Long
James Long 2021년 2월 27일
댓글: Paul Hoffrichter 2021년 2월 28일
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?

답변 (1개)

Paul Hoffrichter
Paul Hoffrichter 2021년 2월 27일
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
James Long
James Long 2021년 2월 28일
편집: James Long 2021년 2월 28일
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 2021년 2월 28일
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.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by