Effacer les filtres
Effacer les filtres

How to have a new line inside a string ?

33 vues (au cours des 30 derniers jours)
Vinothkumar Sethurasu
Vinothkumar Sethurasu le 20 Mai 2021
set(handles.parameterW,'string',{['stiffness = ',num2str(A),' Nm/deg,',' Damping = ',num2str(B),' Nm/(rad/s)']});
Current output:
stiffness = 1 Nm/deg, Damping = 0 Nm/(rad/s)
Output i required:
stiffness = 1 Nm/deg,
Damping = 0 Nm/(rad/s)
  3 commentaires
Vinothkumar Sethurasu
Vinothkumar Sethurasu le 20 Mai 2021
Thanks for your response.
The solution you have provided is working fine.
But, i don't know, how to use inside set(handles.parameterW.....)
Stephen23
Stephen23 le 20 Mai 2021
"But, i don't know, how to use inside set(handles.parameterW.....)"
Change FPRINTF to SPRINTF

Connectez-vous pour commenter.

Réponses (2)

Girijashankar Sahoo
Girijashankar Sahoo le 20 Mai 2021
set(handles.parameterW,'string',{['stiffness = ',num2str(A)+newline+' Nm/deg,',' Damping = ',num2str(B),'
or
set(handles.parameterW,'string',{['stiffness = ',num2str(A),\n' Nm/deg,',' Damping = ',num2str(B),'
  1 commentaire
Vinothkumar Sethurasu
Vinothkumar Sethurasu le 20 Mai 2021
Thanks for your response.
The solution you have provided is not working.

Connectez-vous pour commenter.


Chandra Amma Palanisamy
Chandra Amma Palanisamy le 20 Mai 2021
Hi Vinothkumar,
It is my understanding that you want to insert a newline in a string. The example code is given below:
set(handles.parameterW,'string',{['stiffness = ',num2str(A),' Nm/deg,', newline,' Damping = ',num2str(B),' Nm/(rad/s)']});
Hope this helps.
  1 commentaire
Vinothkumar Sethurasu
Vinothkumar Sethurasu le 20 Mai 2021
Yes.
I got it.
Thank you so much.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by