MATLAB: Data and fprintf

data fprintf

I have the following 2 lines
Data={'The calculated means for ERP0 are ','The standard deviations for ERP0 are ', 'The calculated means for ERP08 ', 'The standard deviations for ERP08 are ', mean0 stdev0 mean08 std08};
fprintf('\n %s %d \n', Data{:})
Where mean0 stdev0 mean08 std08 are 1 by 5 arrays What i want is: The calculated means for ERP0 are… then the numbers in mean0
for each variable and sentence corresponding
What i am currently getting are the words and then the values all displayed underneath like 'The calculated means for ERP0 are ', 'The standard deviations for ERP0 are ', 'The calculated means for ERP08 ', 'The standard deviations for ERP08 are '
then the numbers for mean0 stdev0 mean08 std08

Best Answer

Make Data like this:
Data={'The calculated means for ERP0 are ','The standard deviations for ERP0 are ', 'The calculated means for ERP08 ', 'The standard deviations for ERP08 are '; mean0 stdev0 mean08 std08}
Notice the ";" instead of ",". The point is to make Data a 2x4 cell array rather than 1x8 array, then the fprintf() code you have should get what you want.