Calling an .m file from GUI

  • Follow


Hi all of you, i'm new in this matter of programming a GUI but so far i have made it. I got a problem in execuiting an .m file on the same folder where the archives of the GUI are located.

when i execute this on the comman window all goes like a beauty:

function Hr=Hres(T,P,vec,R)
[Z,q,ee,sigma,beta,tr]=Zpr(T,P,vec);
alfa=@(tr) (1+(0.37464+1.54226.*vec(1,8)-0.26992.*vec(1,8).^2)*(1-tr^0.5))^2;
c=0.37464+1.5422.*vec(1,8)-0.26992.*vec(1,8).^2;
I=zeros(1,2); Hr=zeros(1,2);
for i=1:2
    I(i)=(1/(sigma-ee))*log((Z(i)+sigma*beta)/(Z(i)+ee*beta));
    Hr(i)=(R*T)*(Z(i)-1+((-c*sqrt(tr/alfa(tr)))-1)*q*I(i));
end
end

the answer is the 2 element Hr vector that i expect, but when y run an .m file that calls this from the GUI i got this error message:

???  In an assignment  A(I) = B, the number of elements in B and
 I must be the same.

Error in ==> Hres at 8
    Hr(i)=(R*T)*(Z(i)-1+((-c*sqrt(tr/alfa(tr)))-1)*q*I(i));

Is there a difference between executing an .m file from the command window and a GUI. I have to say that a day before i got this error the GUI worked perfectly and i had no error.

Hoping that you can help me as soon as you can: Cheers.
0
Reply Carlos 11/28/2010 6:56:03 PM

No there's no difference.  Chances are that one of more of R, T, c,
tr, or q is a multi-element vector and so the right hand side of the
equation is two or more elements.  I don't mean to state the really
obvious, but set a breakpoint there and find out.
0
Reply ImageAnalyst 11/28/2010 11:33:16 PM


1 Replies
612 Views

(page loaded in 0.028 seconds)

Similiar Articles:













7/22/2012 4:59:22 AM


Reply: