Outputting a variable (1*1) struct in txt file
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2015년 8월 21일
What format do you want for the output, taking into account that part of the data involves a 14152 x 28 matrix ?
답변 (1개)
Walter Roberson
2015년 8월 21일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!