如何在MATLAB中获得多行控制台输出?使用horzcat会给我一个错误

如何在MATLAB中获得多行控制台输出?使用horzcat会给我一个错误,matlab,Matlab,但是我得到了一个错误: fprintf(['# True Positive: %d \n',... '# False Positive: %d \n',... '# True Negative: %d \n',... '# False Negative: %d \n,',... numTruePos,... numFalsePos,... numTrue

但是我得到了一个错误:

fprintf(['# True Positive: %d \n',...
            '# False Positive: %d \n',...
            '# True Negative: %d \n',...
            '# False Negative: %d \n,',...
            numTruePos,...
            numFalsePos,...
            numTrueNeg,...
            numFalseNeg]);

您似乎将格式字符串的右括号
]
放在了错误的位置。试试这个:

??? Error using ==> horzcat
The following error occurred converting from logical to
char:
Error using ==> char
Conversion to char from logical is not possible.

Error in ==> toyProblem at 40
fprintf(['# True Positive: %d \n',...
fprintf(['# True Positive: %d \n',...
         '# False Positive: %d \n',...
         '# True Negative: %d \n',...
         '# False Negative: %d \n'],...  %# Moved it to here...
         numTruePos,...
         numFalsePos,...
         numTrueNeg,...
         numFalseNeg);  %# ... from here