These are my inputs how can i use str2num in title so that i can display the values of inputs?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
A=input('amplitude= ')
N=input('period= ')
I get the following errors ??? Error using ==> title at 29 Incorrect number of input arguments
Error in ==> title at 23 h = title(gca,varargin{:});
how can i solve the issue?
1 commentaire
Azzi Abdelmalek
le 18 Juin 2015
I don't see how your two lines of codes are related to your question
Réponses (2)
Walter Roberson
le 18 Juin 2015
A=input('amplitude= ')
N=input('period= ')
title(sprintf('Amplitude = %f mm, Period = %f s', A, N))
0 commentaires
Stephen23
le 18 Juin 2015
Modifié(e) : Stephen23
le 18 Juin 2015
A = str2double(input('amplitude= ','s'));
N = str2double(input('period= ','s'));
title(sprintf('Amplitude = %g mm, Period = %g s', A, N))
This avoids the possibility of arbitrary code being input and executed, which is what input without the 's' option will do.
0 commentaires
Voir également
Catégories
En savoir plus sur Elementary Math 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!