How can I create dynamic session title when I am publish my code
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The question is during a for-loop, I want to create the dynamic session title during the loop. For example
for i = 10
%%the current loop is i % I want to generate this session title dynamically
run the code;
end
Because I have lots of figures during the codes, so I want to create more links in the context so I can link to the figures more quick.
Thanks.
0 comentarios
Respuestas (1)
Stephen23
el 23 de Abr. de 2015
Editada: Stephen23
el 23 de Abr. de 2015
It is not very clear what you want to do, but perhaps you are looking to convert a numeric to string? In which case you could use sprintf, or int2str or one of the other number->string conversions functions.
for k = 1:10
sprintf('This is loop number %d',k)
end
2 comentarios
Stephen23
el 23 de Abr. de 2015
Editada: Stephen23
el 24 de Abr. de 2015
So you wish to change comments during code publishing. As far as I am aware code comments are considered to be completely static, and cannot be defined dynamically. Even the LaTeX and HTML markup are interpreted "literally", and do not seem to allow for the inclusion of MATLAB values.
MATLAB's code publishing markup is clearly documented. Depending on what you want to do you might be able to use one of the formatting options available, including numbered lists, hyperlinks, etc.
You might be able to use the include syntax, and write the file dynamically... but this would be a bit of a hack job.
If none of these work, then you will have to create a simple string as per my original answer.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!