MATLAB: For r=1:mrow d1=data(r,​:);cluster​=c(r,1); p=[‘Data object ‘, d1 , ‘is belonging ‘, cluster, ‘Clusters’]; disp(p); end

displayprint

i want display all statement and variable value[array matrix] as single line but it can NOT be displaying variable values. and then all statement will print together to single line.
example: age=26;name='pavan'; disp([name,'is',age,'years old')
O/P: pavan is 26 years old
sothat let you help me for this……..

Best Answer

Use fprintf:
>> fprintf('%s is %d years old\n','Pavan',26)
Pavan is 26 years old
In order to use fprintf you will need to understand how to specify the format string, and how this correlates to its inputs. Read the documentation carefully, and do lots of playing around and experimenting to get comfortable using fprintf.