Export Command Window to Excel
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi, I am pasting part of my code:
X = [PRCP Catch Back Manhole Break];
y = Street;
b4_default = stepwisefit(X,y)
%mdl10001 = fitglm(dsa, modelspec, 'Distribution', 'poisson');
outdata = b4_default;
writematrix(outdata, outfile);
This is what appears in the command window:
Initial columns included: none
Step 1, added column 3, p=3.45962e-15
Step 2, added column 4, p=1.30783e-07
Step 3, added column 1, p=0.00259678
Step 4, added column 2, p=0.00921344
Final columns included: 1 2 3 4
{'Coeff' } {'Std.Err.'} {'Status'} {'P' }
{[0.2564]} {[ 0.0967]} {'In' } {[ 0.0082]}
{[0.2890]} {[ 0.1106]} {'In' } {[ 0.0092]}
{[0.1702]} {[ 0.0477]} {'In' } {[3.9479e-04]}
{[1.0324]} {[ 0.1974]} {'In' } {[2.4544e-07]}
{[0.7337]} {[ 2.0668]} {'Out' } {[ 0.7228]}
b4_default =
0.2564
0.2890
0.1702
1.0324
0.7337
By the way I wrote the code, only this appears on the exported spreadsheet.
b4_default =
0.2564
0.2890
0.1702
1.0324
0.7337
Yet, I want the whole message to appear in the spreadsheet, the columns of "Status" and "P", especially.
Thanks!
댓글 수: 0
채택된 답변
Walter Roberson
2020년 8월 11일
You can use evalc() to capture the text that would be emitted by a computation.
The result will be a character vector with included newline characters, which is perfect if you want to fopen() / fwrite() / fclose(). But in some situations you might want to use strsplit() or regexp(S, '\n', 'split')
댓글 수: 3
Walter Roberson
2020년 8월 12일
편집: Walter Roberson
2020년 8월 12일
msgs = evalc('b4_default = stepwisefit(X,y)');
msgs2 = evalc('b4_default');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!