Export Command Window to Excel
14 views (last 30 days)
Show older comments
CMatlabWold
on 11 Aug 2020
Commented: CMatlabWold
on 12 Aug 2020
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 Comments
Accepted Answer
Walter Roberson
on 11 Aug 2020
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 Comments
Walter Roberson
on 12 Aug 2020
Edited: Walter Roberson
on 12 Aug 2020
msgs = evalc('b4_default = stepwisefit(X,y)');
msgs2 = evalc('b4_default');
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!