Outputting a variable (1*1) struct in txt file
Mostra commenti meno recenti
Hello everybody
I run the regression analysis and have got a varialble with reg [1*1 struct] I want to output this in a txt file but its giving me an error this is the out out
reg =
FitParameters: '-----------------'
PowerMatrix: [28x6 double]
Scores: [14152x28 double]
PolynomialExpression: [28x2 table]
Coefficients: [28x1 double]
yhat: [14152x1 double]
Residuals: [14152x1 double]
GoodnessOfFit: '-----------------'
RSquare: 0.6721
MAE: 0.0693
MAESTD: 0.0593
Normalization: '1-to-1 (Default)'
LOOCVGoodnessOfFit: '-----------------'
CVRSquare: 0.6684
CVMAE: 0.0696
CVMAESTD: 0.0600
CVNormalization: '1-to-1 (Default)'
Can anybody help me with this as save('X.txt...') is not working
2 Commenti
Walter Roberson
il 21 Ago 2015
What format do you want for the output, taking into account that part of the data involves a 14152 x 28 matrix ?
amberly hadden
il 21 Ago 2015
Risposte (1)
Walter Roberson
il 21 Ago 2015
0 voti
Xls might not make sense unless you use one Sheet per variable.
I suggest looping over the fields of the structure. For each write out the fieldname then the class() of the data then the array dimensions all on one line. Next line write the values out row by row, delimited, all columns on each line. For 2d arrays the number of rows in the file would match the number of rows in the matrix. You only use 2d in your sample output.
With this kind of arrangement, the heading for each variable tells you how many lines of data follow so you can gulp them all in in one textscan call or otherwise easily seek for the line you need.
2 Commenti
Walter Roberson
il 21 Ago 2015
Though the table() object will take a bit more effort.
amberly hadden
il 21 Ago 2015
Modificato: Walter Roberson
il 22 Ago 2015
Categorie
Scopri di più su Structures in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!