Clear Filters
Clear Filters

Data and fprintf

1 view (last 30 days)
Zach
Zach on 30 Sep 2011
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

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 30 Sep 2011
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.

More Answers (0)

Categories

Find more on Biomedical Signal Processing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!