copy and paste code with formatting

조회 수: 38 (최근 30일)
Larry Brunson
Larry Brunson 2019년 2월 21일
답변: Aniket 2025년 6월 9일
Is there a way to copy from Matlab editor in a way that preserves formatting, so when I paste into another application it appears just as it did in Matlab? One possibility was if Matlab could receive a Notepad++ plug-in.
I realized that copy and paste works for the Matlab editor, but my actual application was to preserve formatting (font and color) in the Command Window.
  댓글 수: 3
Larry Brunson
Larry Brunson 2019년 2월 21일
편집: Larry Brunson 2019년 2월 21일
Color and font. My actual concern was preserving formatting from the Command Window, but I asked about Editor because I thought that question may be more common, and may have the same answer. Then I realized that copy & paste already preserves formatting for the Editor. Does anyone else care about preserving error messages in their original formatting?
Rik
Rik 2019년 2월 21일
A Notepad++ plugin is impossible, since there is no way to know if a text should be red, orange or black, even assuming you haven't changed those colors in your preferences.
I had expected that it would already do that (copy with format) to e.g. Word, but apparently that doesn't. I guess there is probably some Java wizardry you could do to do it anyway.

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

답변 (1개)

Aniket
Aniket 2025년 6월 9일
In the MATLAB's new desktop released in R2025a, the text formatting remains preserved when copying from command window.
However, prior to this release, there is no method to preserve formatting. I recommend upgrading to the latest version of MATLAB.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by