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

26 visualizaciones (últimos 30 días)
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...

Respuesta aceptada

Walter Roberson
Walter Roberson el 5 de Dic. de 2025 a las 3:40
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 comentarios
Walter Roberson
Walter Roberson el 5 de Dic. de 2025 a las 8:53
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Entering Commands en Help Center y File Exchange.

Productos


Versión

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by