Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How can I show the result of the fitting in text box?

Subject: How can I show the result of the fitting in text box?

From: Amr Sadek

Date: 13 Feb, 2013 14:42:06

Message: 1 of 4

I have a GUI that fits some data with custom equations. I want to show the result of the fitting process (the equation, the Coefficients and the goodness of the fitting) on a text box in the GUI instead of the MATLAB command window.

Thanks...

Subject: How can I show the result of the fitting in text box?

From: dpb

Date: 13 Feb, 2013 18:46:52

Message: 2 of 4

On 2/13/2013 8:42 AM, Amr Sadek wrote:
> I have a GUI that fits some data with custom equations. I want to show
> the result of the fitting process (the equation, the Coefficients and
> the goodness of the fitting) on a text box in the GUI instead of the
> MATLAB command window.
> Thanks...

How are you obtaining the coefficients, etc., ...?

Instead of letting that output go to the command window, save it to
appropriate variables and then use sprintf() and/or friends to format as
desired as input to the text box.

--

Subject: How can I show the result of the fitting in text box?

From: Amr Sadek

Date: 14 Feb, 2013 08:55:12

Message: 3 of 4

dpb <none@non.net> wrote in message <kfgn2p$u4q$1@speranza.aioe.org>...
> On 2/13/2013 8:42 AM, Amr Sadek wrote:
> > I have a GUI that fits some data with custom equations. I want to show
> > the result of the fitting process (the equation, the Coefficients and
> > the goodness of the fitting) on a text box in the GUI instead of the
> > MATLAB command window.
> > Thanks...
>
> How are you obtaining the coefficients, etc., ...?
>
> Instead of letting that output go to the command window, save it to
> appropriate variables and then use sprintf() and/or friends to format as
> desired as input to the text box.
>
> --
This is the main problem. I can't save it to variables. Here is an example;
-------------------------------------------------------------------------------------------------------------------
FIT2GOK =
     General model:
     FIT2GOK(T) = (no).*S.*exp(-E./(K.*T)).* (1+(b-1).*(S/R).*(((K.*T.^2./(E+
                    (2.*K.*T)))).*exp(-E./(K.*T)))-((K.*Ti.^2./(E+(2.*K.*Ti)
                    ))).*exp(-E./(K.*Ti))).^(-b./(b-1))
     Coefficients (with 95% confidence bounds):
       E = 1.71 (1.707, 1.713)
       S = 2.573e+13 (2.435e+13, 2.712e+13)
       b = 1.261 (1.222, 1.299)
       no = 579 (567.8, 590.2)
     Problem parameters:
       R = 3
       Ti = 374
       K = 8.617e-05
--------------------------------------------------------------------------------------------------------------------
The variable name is "FIT2GOK". I can't send this variable directly to the text box because of this error:
---------------------------------------------------------------------------------------------------------------------
Error using set
error: mxArray must be double, char, or cell
---------------------------------------------------------------------------------------------------------------------

Subject: How can I show the result of the fitting in text box?

From: Steven_Lord

Date: 14 Feb, 2013 14:49:02

Message: 4 of 4



"Amr Sadek" <dr_amrsadek@hotmail.com> wrote in message
news:kfi8pg$4o$1@newscl01ah.mathworks.com...
> dpb <none@non.net> wrote in message <kfgn2p$u4q$1@speranza.aioe.org>...
>> On 2/13/2013 8:42 AM, Amr Sadek wrote:
>> > I have a GUI that fits some data with custom equations. I want to show
>> > the result of the fitting process (the equation, the Coefficients and
>> > the goodness of the fitting) on a text box in the GUI instead of the
>> > MATLAB command window.
>> > Thanks...
>>
>> How are you obtaining the coefficients, etc., ...?
>>
>> Instead of letting that output go to the command window, save it to
>> appropriate variables and then use sprintf() and/or friends to format as
>> desired as input to the text box.
>>
>> --
> This is the main problem. I can't save it to variables. Here is an
> example; -------------------------------------------------------------------------------------------------------------------
> FIT2GOK = General model:
> FIT2GOK(T) = (no).*S.*exp(-E./(K.*T)).*
> (1+(b-1).*(S/R).*(((K.*T.^2./(E+
>
> (2.*K.*T)))).*exp(-E./(K.*T)))-((K.*Ti.^2./(E+(2.*K.*Ti)
> ))).*exp(-E./(K.*Ti))).^(-b./(b-1))
> Coefficients (with 95% confidence bounds):
> E = 1.71 (1.707, 1.713)
> S = 2.573e+13 (2.435e+13, 2.712e+13)
> b = 1.261 (1.222, 1.299)
> no = 579 (567.8, 590.2)
> Problem parameters:
> R = 3
> Ti = 374
> K = 8.617e-05

Use EVALC to generate a string that you can use in your GUI's text box.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us