Using 'disp' function with variables

1,024 views (last 30 days)
I have a line of code which is giving me some trouble and I cant understand why:
disp('There is an ice rule violation at: (', xd, ',', yd, ')')
where xd and yd are variables that are generated beforehand and I simply want it to display:
There is an ice rule violation at: (7,8)
where 7 and 8 are examples of xd and yd respectively and the program gives me an error:
Error using disp
Too many input arguments.
Error in New_correlation_values_3_2/checkvertex (line 145)
disp('There is an ice rule violation at: (', xd, ',', yd, ')')
Error in New_correlation_values_3_2 (line 45)
[N,avg] = checkvertex(xd,yd,M,N,ic,jc);

Accepted Answer

ES on 29 Aug 2013
disp() takes only one argument.
To accomplish what you need, do disp(['There is an ice rule violation at: (', num2str(xd), ',', num2str(yd), ')'])

More Answers (1)

chaibrassou mohamed salah
X= input (' veuillez introduire votre numéro d inscription = ','s');
Y= input (' veuillez introduire votre Nom = ','s');
Z= input (' veuillez introduire votre Prénom = ','s');
A= input (' veillez introduire votre Date de naissance sous forme de nombre entier Année = ','s');
B= input (' mois = ','s');
C =input ('jour= ','s');
E=input (' Quel est votre Groupe =','s');
F = input('Quelle est votre Année universitaire sous forme debut de l annne/fin de l Année/n debut de l Année =','s');
G=input ('fin de l Année=','s');
disp('numéro d inscription:',X,'\n','Nom:',Y,'\n',' Prénom :',Z,'\n','Date de naissance ',A,'/',B,'/',C,'\n','Groupe : ',E,'\n',' Année universitaire : ',F,'/',G)


Find more on Oceanography and Hydrology in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!