Data and fprintf

조회 수: 1 (최근 30일)
Zach
Zach 2011년 9월 30일
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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 9월 30일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bioinformatics Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by