Adding a newline character
Mostrar comentarios más antiguos
I have a string array. I need to print all the strings in the array line by line in a word report through Matlab report Generation with Each string on a new line. I am not able to do it. Adding newline character '\n' generates a continuous string with the characters \n included in it. even char(10) does not work.
This is sample code
for i = 1:length(My_Array)
setParent(rptgen.cfr_text('Content',My_Array{i}), Paragraph_Block);
setParent(rptgen.cfr_text('Content',char(10)), Paragraph_Block);
Can anybody tell me what I need to do to get the right results?
Respuesta aceptada
Más respuestas (2)
Andrew Newell
el 6 de Abr. de 2011
Try
sprintf('%s\n',My_Array{i})
1 comentario
Wilson Bardeskar
el 6 de Abr. de 2011
Andrew Newell
el 6 de Abr. de 2011
Unfortunately, I don't have the Report Generator, and the online documentation about the rptgen classes is not very helpful. However, I notice that in the documentation for text, one of the Style options is Retain spaces and carriage returns. If you can figure out how to set this, you might get what you want. Try typing
h = rptgen.cfr_text;
set(h)
and see what you get.
It appears that the documentation is mostly for people using the GUI interface. Have you tried using that?
3 comentarios
Wilson Bardeskar
el 6 de Abr. de 2011
Wilson Bardeskar
el 6 de Abr. de 2011
Andrew Newell
el 6 de Abr. de 2011
I'm glad I could help with my shots in the dark! You might want to send MATLAB some feedback on their help for this subject.
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!