Can "diary" be set to export exact text where hyperlinks are invoked instead of code or other characters?

17 visualizzazioni (ultimi 30 giorni)
The output of "diary" echoes what appears in the Command window, except for certain hyperlinks invoked by Matlab. Is there a way to echo literally what appears on the screen instead of code?
For example,
str = sprintf('%s%s', ...
'<a href="matlab:magic(4)">', ...
'Generate magic square</a>');
disp(str)
MATLAB displays this in the Command Window:
However, the diary file, when viewed in a text editor, shows this text instead:
<a href="matlab:magic(4)">Generate magic square</a>
Thanks in advance...

Risposta accettata

Walter Roberson
Walter Roberson circa 13 ore fa
No. In order for that to work, the entire file would need to be formatted as HTML.
Formatting the file as HTML would involve more than adding in a <HTML> header. HTML treats all whitespace as being equal, and does automatic line wrapping, so it would be necessary to add in <BR> at the end of every line and convert spaces to <nbsp;> to get the right formatting.
  3 Commenti
Walter Roberson
Walter Roberson circa 2 ore fa
Code could be written that parsed diary entries and emitted HTML. It would be a matter of substituting <nbsp;> for all spaces except for <a href and then putting in <br> at the end of every line, and finally wrapping with <HTML> headers.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Prodotti


Release

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by