sprintf does not work when called from a function
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zoltán Csáti
el 4 de Oct. de 2014
Comentada: Zoltán Csáti
el 4 de Oct. de 2014
I would like to use the advantages of sprintf over disp, but I have a problem with it. From my main function I invoke an other function which contains the command sprintf. As a result, nothing is printed out to the screen. That specific function is called many times, therefore I do not want to dismiss that function and use the main function only. What can I do? I need the formatting capabilities of sprintf that disp can not provide.
Thanks, Zoli
0 comentarios
Respuesta aceptada
dpb
el 4 de Oct. de 2014
sprintf doesn't print to command window, it writes output to a string variable so unless you left the trailing ";" off the line in the m-file of the function that's expected behavior.(*)
Use fprintf instead...
doc fprintf % for details
Más respuestas (0)
Ver también
Categorías
Más información sobre Entering Commands en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!