fprintf('A is %6.4f and b is %6.4f', [a(:), b(:)].' );
Note: this will not print in the order you indicated because in MATLAB, the second variable of "a" is the 4, not the 2. If you want to print across the rows instead of down the columns, then
fprintf('A is %6.4f and b is %6.4f', permute(cat(3,a,b), [3 2 1]));
and the first version, taking the values in column order, can be done as
fprintf('A is %6.4f and b is %6.4f', permute(cat(3,a,b), [3 1 2]));
Best Answer