Export Command Window to Excel

12 ビュー (過去 30 日間)
CMatlabWold
CMatlabWold 2020 年 8 月 11 日
コメント済み: CMatlabWold 2020 年 8 月 12 日
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!

採用された回答

Walter Roberson
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
Walter Roberson 2020 年 8 月 12 日
編集済み: Walter Roberson 2020 年 8 月 12 日
msgs = evalc('b4_default = stepwisefit(X,y)');
msgs2 = evalc('b4_default');
CMatlabWold
CMatlabWold 2020 年 8 月 12 日
It works - thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by