hi, i have build a matix. i have turned diary mode on ('diary on'). i wanna change just last row color of matix in output file. how? thank you.

 채택된 답변

dpb
dpb 2021년 7월 4일

0 개 추천

See the Limitations and Tips section of the doc for diary
Limitations
Because the output of diary is plain text, the log file does not exactly mirror what you see on screen:
  • The diary file does not include graphics (figure windows).
  • The diary file does not preserve syntax highlighting and font preferences.
  • The diary file shows hidden components in the Command Window, such as hyperlink information generated with matlab:, in plain text. For example, if you enter this statement in the Command Windowstr = sprintf('%s%s', ...
'<a href="matlab:magic(4)">', ...
'Generate magic square</a>');
disp(str)
MATLAB displays
However, the diary file, when viewed in a text editor, shows
str = sprintf('%s%s', ...
'<a href="matlab:magic(4)">', ...
'Generate magic square</a>');
disp(str)
<a href="matlab:magic(4)">Generate magic square</a>
Tips
  • To view the contents of the diary file with syntax highlighting, use the type function.

댓글 수: 9

armin m
armin m 2021년 7월 5일
So according to your answer in diary mode it is impossible. In which format can i do the mentioned above question? Tnx
dpb
dpb 2021년 7월 5일
That's what the doc says, not me.
I don't have any idea; I use MATLAB to compute with, not for presentation, so I've never looked into any of the report generation stuff.
armin m
armin m 2021년 7월 5일
Tnx
dpb
dpb 2021년 7월 5일
I dunno if you were to echo a font color change or embed a TeX color code in the output the result with type would reflect that or not -- that would be only way I could see something might possibly happen with the output stream from diary; as the doc says, all it does is translate and echo what is in the command sequence it sees as the text; the command window display code isn't written to interpret output codes for presentation, it just echoes ASCII characters; only if there is a hardware/software interrupt on a given control string like the linefeed, etc., that is in default terminal display io will those limited control characters be recognized.
armin m
armin m 2021년 7월 5일
I do not fully understand what u said. I just want show one row of matrix with different color in command window and exported file.
dpb
dpb 2021년 7월 5일
편집: dpb 2021년 7월 5일
See the Tip comment above about type -- it has the facility to draw at least some of the embedded formatting information on the screen when it processes a diary file, but the builtin command window output code simply doesn't have that ability.
"I just want show one row of matrix with different color in command window and exported file."
Well, sometimes we just can't have everything we want. The command window isn't set up to do that; it was a product from 40 years ago when such niceties were unheard of and still is the interface to enter user commands and see output interactively, but is not designed nor intended to be a presentation manager. TMW has products for that purpose specifically or you can export to other formats that do have the facility, but not at the command window.
The new intereactive editor may have some additional facilities; I dunno about that; I've also never used it nor even opened it up as it simply isn't what I'm into with MATLAB. Maybe somebody else will add some other ideas.
Text files also are just that--text files; it takes something like html or other formatting code to produce such effects and then a specialized program to read the file and interpret those commands to put "the right stuff" on the screen. That tool just isn't the command window in MATLAB, sorry.
armin m
armin m 2021년 7월 6일
Thank you for full explanation and the time you spent.
dpb
dpb 2021년 7월 6일
No problem...another way to think of it is it's why there is the Interpreter property for text and tick labels, or why need Adobe Reader for pdf files (and why need .pdf and TeX or LaTeX, etc., etc., ...)
armin m
armin m 2021년 7월 6일

Ok.very good.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 7월 4일

댓글:

2021년 7월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by