It is possible to use sprintf to print a string input?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Madalena Francisco
le 15 Jan 2023
Commenté : Madalena Francisco
le 15 Jan 2023
Hi, I´m trying to print what the user inputs as a string, but it´s not working with this code below:
Thanks!!
clc, clear, close
vi=input('Indicate the name of the independent variable: ','s');
c1= sprintf('Indicate the units of the variable %0.0s',vi);
vi_u=input(c1);
3 commentaires
Réponse acceptée
the cyclist
le 15 Jan 2023
I think you want
c1= sprintf('Indicate the units of the variable %s',vi);
rather than
c1= sprintf('Indicate the units of the variable %0.0s',vi);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing 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!