Complete the code to format the number 10 as a string using sprintf.
str = sprintf([1], 10);
The '%d' format specifier tells sprintf to format the number as an integer.
Complete the code to format the number 3.14159 with two decimal places using sprintf.
str = sprintf([1], 3.14159);
The '%.2f' format specifier formats the number as a floating-point with 2 decimal places.
Fix the error in the code to correctly format the string with a name and age.
str = sprintf('Name: %s, Age: [1]', 'Alice', 30);
The '%d' specifier is used to format the integer age correctly.
Fill both blanks to format a floating number with 3 decimals and a string.
str = sprintf('Value: [1], Status: [2]', 12.34567, 'OK');
'%.3f' formats the number with 3 decimals, and '%s' formats the string.
Fill all three blanks to format a string with a name, integer age, and floating-point score with 1 decimal.
str = sprintf('Name: [1], Age: [2], Score: [3]', 'Bob', 25, 88.765);
'%s' formats the name string, '%d' formats the integer age, and '%.1f' formats the score with one decimal place.