[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index

Re: Urgent, SOS regarding compare two strings , Thanks 4 help!

> if strcmp('str1','str')

I hope you *do* realise that this will always evaluate to <false> and never
excute

>     cmdStr=str2mat( 'correct')


Roy

http://www.danielsorogon.com/Webmaster

"Alan" <fire789cn@yahoo.com> wrote in message
news:eed14b8.-1@webx.raydaftYaTP...
> Hi, I need to compare two strings from a text filed and a
> popupmenu,the result should be "corret" and "incorret" in a
> minicomend window, but i tried lot times still can not get
> "corret",anyone can provide help, thanks a lot ! the code as below:
>
> function popupmenu2_Callback(hObject, eventdata, handles)
> val = get(hObject,'Value');
> str = get(hObject, 'String');
> switch str{val};
> case 'A'
>     cmdStr=str2mat( 'Please type in A')
> case 'B'
>      cmdStr=str2mat( 'Please type in B')
> case 'C'
>     cmdStr=str2mat( 'Please type in C')
> case 'D'
>     cmdStr=str2mat( 'Please type in D')
> end
>     mcwHndl=get(gcf,'UserData');
>     set(mcwHndl,'String',cmdStr);
>
> function edit5_Callback(hObject, eventdata, handles)
> str1=get(hObject,'String')
>
> function pushbutton_start_Callback(hObject, eventdata, handles)
> if strcmp('str1','str')
>     cmdStr=str2mat( 'correct')
> else cmdStr=str2mat( 'error')
>           mcwHndl=get(gcf,'UserData');
>     set(mcwHndl,'String',cmdStr);
> end


[Date Prev][Date Next][Thread Prev][Thread Next]
Author IndexDate IndexThread Index