Formatting output

 
a = pi
>>  a =  3.1416
format long
a
>>  a =  3.14159265358979
format short
a
>>  a =  3.1416
sprintf('Value of PI: %0.3f', a)
>> ans = Value of PI: 3.142
sprintf('Value of PI: %0.6f', a)
>> ans = Value of PI: 3.141593
disp(sprintf('Value of PI: %0.6f', a))
% displays the value without printing the variable name
>>  Value of PI: 3.141593