Converting the outpur of a fit (e.g. sfit) into a string format, then pasting the text to a Text Area in app desginer

6 ビュー (過去 30 日間)
Saeid
Saeid 2023 年 8 月 22 日
移動済み: Matt J 2023 年 8 月 22 日
I have two problems:
1- I don't know how I can convert the output of a fit, which in my case comes as the class "sfit", into a text format that can then be edited further. Example of the fit:
Linear model Poly11:
CTEta0Fit(x,y) = p00 + p10*x + p01*y
Coefficients (with 95% confidence bounds):
p00 = -1.718 (-1.945, -1.492)
p10 = 18.85 (17.33, 20.38)
p01 = -0.006215 (-0.007869, -0.00456)
2- When I do this, is there a possibility to copy this text into a Text Area in the App Designer? I would like to create something like Log interface where a summary of activities is shown.

回答 (2 件)

Les Beckham
Les Beckham 2023 年 8 月 22 日
移動済み: Matt J 2023 年 8 月 22 日
Another option (which does essentially the same thing) is this:
load census;
f = fit(cdate,pop,'poly2');
s = formattedDisplayText(f)
s =
" Linear model Poly2: ary(x) = p1*x^2 + p2*x + p3 Coefficients (with 95% confidence bounds): p1 = 0.006541 (0.006124, 0.006958) p2 = -23.51 (-25.09, -21.93) p3 = 2.113e+04 (1.964e+04, 2.262e+04)"

Matt J
Matt J 2023 年 8 月 22 日
編集済み: Matt J 2023 年 8 月 22 日
I don't know how I can convert the output of a fit, which in my case comes as the class "sfit", into a text format that can then be edited further.
For example,
load census;
f=fit(cdate,pop,'poly2');
s=string(evalc('disp(f)'))
s =
" Linear model Poly2: f(x) = p1*x^2 + p2*x + p3 Coefficients (with 95% confidence bounds): p1 = 0.006541 (0.006124, 0.006958) p2 = -23.51 (-25.09, -21.93) p3 = 2.113e+04 (1.964e+04, 2.262e+04) "
is there a possibility to copy this text into a Text Area in the App Designer?
Of course!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by