Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: gui problem
Replies: 2   Last Post: Apr 9, 2011 5:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
anil.m.007@gmail.com

Posts: 22
Registered: 2/16/11
gui problem
Posted: Apr 8, 2011 7:26 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

hi sir,

i am creating one gui according to my work. i have two pushbuttons in my gui one for writing values and another one is reading the values

function Read_Callback(hObject, eventdata,handles)
tic
pm = get(handles.pmbus,'String');
d=hex2dec(pm);
fwrite(handles.serConn,[d 136]);
rb = fscanf(handles.serConn);
y = dec2hex(rb);
cd=strcat(y);
sa=strcat(cd(1),cd(3),cd(2),cd(4));
x=hex2dec(sa);
exp=(-2*bitget(x,16)+1)*(bitcmp(bitshift(x,-11),5)+1);
mant=bitand(hex2dec('7ff'),x);
vout=mant*2^exp;
vo=num2str(vout);
set(handles.vinput,'String',vo);

function write_Callback(hObject, eventdata,handles)
pm=get(handles.pmbus,'String');
d=hex2dec(pm);
if isa(d, 'numeric')
a=get(handles.ov,'String');
x=str2num(a);
if isempty(x)
else
exp=fix(log2(1023/x));
mant=round(x*2^exp);
val=bitor(bitshift(bitcmp(fix(log2(1023/x))-1,5),11),mant);
he = dec2hex(val,4);
a=he(1:2);
b=he(3:4);
c=hex2dec(a);
e=hex2dec(b);
fwrite(handles.serConn,[d c e]);
end
end

first i run my gui and if i click on read call back its working very fine. if i click write button first and click read button second its giving error like this

??? Error using ==> set
Invalid handle object.

Error in ==> test>Read_Callback at 694
set(handles.vinput,'String',vo);

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> test at 20
gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)test('Read_Callback',hObject,eventdata,guidata(hObject))


??? Error while evaluating uicontrol Callback


i can't copy hole code here because its 1000 line code so can any one plz help me what is wrong in my code
i can't able to solve this problem
plz help me..
thank you,



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.