From: Ashish Uthama on
On Tue, 13 Apr 2010 11:11:10 -0300, riya sen <nehakalra_15(a)yahoo.com>
wrote:

> "Ashish Uthama" <first.last(a)mathworks.com> wrote in message
> <op.va3ndbfea5ziv5(a)uthamaa.dhcp.mathworks.com>...
>> On Mon, 12 Apr 2010 21:15:07 -0300, neha kalra
>> <nehakalra_15(a)yahoo.com> wrote:
>> > Thank you. I solved that issue thanks to your insight. However,
>> finally > I need to correlate the letters A-Z to the words on the
>> listbox. For > example, when I click on "A"pushbutton it should point
>> to the first > alphabetical letter "A" in the listbox and vice versa
>> for B. Here is the > current coding:
>> >
>> > function exampleGUI
>> > Txt = uicontrol ('Style', 'edit','tag','editbox', 'Position', [300,
>> 650, > 700, 60]);
>> > A = uicontrol >
>> ('Style','PushButton','String','A','Position',[50,550, 130, 80],...
>> > 'CallBack', @APressed);
>> > B= uicontrol >
>> ('Style','PushButton','String','B','Position',[200,550, 130,80],...
>> > 'CallBack', @BPressed);
>> > C= uicontrol
>> ('Style','PushButton','String','C','Position',[350,550, > 130,80],...
>> > 'CallBack', @CPressed);
>> > D= uicontrol
>> ('Style','PushButton','String','D','Position',[500,550, > 130,80],...
>> > 'CallBack', @DPressed);
>> > E= uicontrol
>> ('Style','PushButton','String','E','Position',[650,550, > 130,80],...
>> > 'CallBack', @EPressed);
>> > F= uicontrol
>> ('Style','PushButton','String','F','Position',[800,550, > 130,80],...
>> > 'CallBack', @FPressed);
>> > G= uicontrol
>> ('Style','PushButton','String','G','Position',[50,450, > 130,80],...
>> > 'CallBack', @GPressed);
>> > H= uicontrol
>> ('Style','PushButton','String','H','Position',[200,450, > 130,80],...
>> > 'CallBack', @HPressed);
>> > I= uicontrol
>> ('Style','PushButton','String','I','Position',[350,450, > 130,80],...
>> > 'CallBack', @IPressed);
>> > J= uicontrol
>> ('Style','PushButton','String','J','Position',[500,450, > 130,80],...
>> > 'CallBack', @JPressed);
>> > K= uicontrol
>> ('Style','PushButton','String','K','Position',[650,450, > 130,80],...
>> > 'CallBack', @KPressed);
>> > L= uicontrol
>> ('Style','PushButton','String','L','Position',[800,450, > 130,80],...
>> > 'CallBack', @LPressed);
>> > M= uicontrol ('Style','PushButton','String','M','Position',[50,350,
>> > 130,80],...
>> > 'CallBack', @MPressed);
>> > N= uicontrol
>> ('Style','PushButton','String','N','Position',[200,350, > 130,80],...
>> > 'CallBack', @NPressed);
>> > O= uicontrol
>> ('Style','PushButton','String','O','Position',[350,350, > 130,80],...
>> > 'CallBack', @OPressed);
>> > P= uicontrol
>> ('Style','PushButton','String','P','Position',[500,350, > 130,80],...
>> > 'CallBack', @PPressed);
>> > Q= uicontrol
>> ('Style','PushButton','String','Q','Position',[650,350, > 130,80],...
>> > 'CallBack', @QPressed);
>> > R= uicontrol
>> ('Style','PushButton','String','R','Position',[800,350, > 130,80],...
>> > 'CallBack', @RPressed);
>> > S= uicontrol ('Style','PushButton','String','S','Position',[50,250,
>> > 130,80],...
>> > 'CallBack', @SPressed);
>> > T= uicontrol
>> ('Style','PushButton','String','T','Position',[200,250, > 130,80],...
>> > 'CallBack', @TPressed);
>> > U= uicontrol
>> ('Style','PushButton','String','U','Position',[350,250, > 130,80],...
>> > 'CallBack', @UPressed);
>> > V= uicontrol
>> ('Style','PushButton','String','V','Position',[500,250, > 130,80],...
>> > 'CallBack', @VPressed);
>> > W= uicontrol
>> ('Style','PushButton','String','W','Position',[650,250, > 130,80],...
>> > 'CallBack', @WPressed);
>> > X= uicontrol
>> ('Style','PushButton','String','X','Position',[800,250, > 130,80],...
>> > 'CallBack', @XPressed);
>> > Y= uicontrol ('Style','PushButton','String','Y','Position',[50,150,
>> > 130,80],...
>> > 'CallBack', @YPressed);
>> > Z= uicontrol
>> ('Style','PushButton','String','Z','Position',[200,150, > 130,80],...
>> > 'CallBack', @ZPressed);
>> > function APressed (h, eventdata)
>> > set (Txt, 'String', 'A')
>> > end; function BPressed (h, eventdata)
>> > set (Txt, 'String', 'B');
>> > end; function CPressed (h, eventdata)
>> > set (Txt, 'String', 'C')
>> > end; function DPressed (h, eventdata)
>> > set (Txt, 'String', 'D');
>> > end; function EPressed (h, eventdata)
>> > set (Txt, 'String', 'E')
>> > end; function FPressed (h, eventdata)
>> > set (Txt, 'String', 'F');
>> > end; function GPressed (h, eventdata)
>> > set (Txt, 'String', 'G')
>> > end; function HPressed (h, eventdata)
>> > set (Txt, 'String', 'H');
>> > end; function IPressed (h, eventdata)
>> > set (Txt, 'String', 'I')
>> > end; function JPressed (h, eventdata)
>> > set (Txt, 'String', 'J');
>> > end; function KPressed (h, eventdata)
>> > set (Txt, 'String', 'K')
>> > end; function LPressed (h, eventdata)
>> > set (Txt, 'String', 'L');
>> > end; function MPressed (h, eventdata)
>> > set (Txt, 'String', 'M')
>> > end; function NPressed (h, eventdata)
>> > set (Txt, 'String', 'N');
>> > end; function OPressed (h, eventdata)
>> > set (Txt, 'String', 'O')
>> > end; function PPressed (h, eventdata)
>> > set (Txt, 'String', 'P');
>> > end; function QPressed (h, eventdata)
>> > set (Txt, 'String', 'Q')
>> > end; function RPressed (h, eventdata)
>> > set (Txt, 'String', 'R');
>> > end; function SPressed (h, eventdata)
>> > set (Txt, 'String', 'S')
>> > end; function TPressed (h, eventdata)
>> > set (Txt, 'String', 'T');
>> > end; function UPressed (h, eventdata)
>> > set (Txt, 'String', 'U')
>> > end; function VPressed (h, eventdata)
>> > set (Txt, 'String', 'V');
>> > end; function WPressed (h, eventdata)
>> > set (Txt, 'String', 'W')
>> > end; function XPressed (h, eventdata)
>> > set (Txt, 'String', 'X');
>> > end; function YPressed (h, eventdata)
>> > set (Txt, 'String', 'Y')
>> > end; function ZPressed (h, eventdata)
>> > set (Txt, 'String', 'Z');
>> > end;
>> > listbox = uicontrol ('style','listbox','units','normalized',...
>> > 'Position',[.8, .4, .2 , >
>> .46],'String',{'A';'Am';'Are';'Able';'Above';'According';'Account';'Across';...
>> > 'Act';'Action';'Activity'; 'Actually'; >
>> 'Added';'Addition';'After';'Again'; >
>> 'Against';'Age';'Ago';'Ahead';'Aid';'Air';'All';'Almost';'Alone';...
>> >
>> 'Along';'Already';'Also';'Although';'Always';'And';'Another';'Answer';'Anti';'Anyone';'Any';'Anything';'Appear';'Approach';'Area';'Arms';...
>> >
>> 'Around';'Art';'Ask';'Asked';'attack';'Attention';'available';'Average';'Away';
>> > 'B';'Bad';'Ball';'Based';'Basic';'Basis';'Be';'Beautiful';...
>> >
>> 'Became';'Because';'Become';'Bed';'Been';'Before';'Began';'Beginning';'Behind';'Being';'Believe';'Below';
>> > 'Best';'Better';'Between';'Beyond';...
>> >
>> 'Big';'Bill';'Black';'Blood';'Blue';'Board';'Body';'Book';'Born';'Both';'Bring';'British';'Brought';'Brown';'Building';'Built';'Business';...
>> > 'But';'By'});
>> > % Define listbox Callback property to update edit box
>> > set (listbox, 'Callback', @(src, evt) listCallback (src, Txt));
>> > end
>> > function listCallback (src, editBoxHandle)
>> > % Get current selection number
>> > value = get (src, 'Value');
>> > % Get entire string array.
>> > strArr = get (src,'String');
>> > % Index into string array to retrieve selection
>> > selection = strArr {value};
>> > set (editBoxHandle, 'String', selection);
>> > end
>> >
>> >
>> >
>> >
>> > NOTE: I just have words from A-B on listbox, so basically I need to
>> get > the basic idea for pushbuttons "A" and "B" and i can apply that
>> all the > way down to Z. So saying once again, when you click on "A",
>> it should > point to the first letter alphabetically and also when you
>> click on "B", > it should point to "B" on listbox. Take care
>> >
>> >
>> > "Ashish Uthama" <first.last(a)mathworks.com> wrote in message >
>> <op.va2dy2p7a5ziv5(a)uthamaa.dhcp.mathworks.com>...
>> >> On Sun, 11 Apr 2010 22:13:03 -0300, neha kalra >>
>> <nehakalra_15(a)yahoo.com> wrote:
>> >> > Copy and paste code into MATLAB m-fiLe and run it. Please help
>> us >> out in > when u click on "A" for example, it should pop up an A
>> on the >> screen > above it. Right now you can tell, when u click on
>> the words >> on the > listbox, it pops up on the screen above it. I
>> would like to >> have that > happen plus clicking on a letter from a
>> pushbutton can pop >> a letter on > the screen. I will pay big bucks
>> for anyone who can >> alter the code in > this manner ($100's) and
>> please send it to >> nehakalra_15(a)yahoo.com.
>> >> >
>> >> Did you have a chance to look at the answer in your other thread?
>> >> Replace
>> >> function APressed (h, eventdata)
>> >> set (Txt, 'String', 'A')
>> >> with: (To append to existing text in the editbox, and update
>> listbox >> text selection on right (warning: air code!)
>> >> function APressed (h, eventdata)
>> >> %append current pressed key char to string in editbox
>> >> currentText = get(Txt,'String')
>> >> updatedText = [currentText Txt];
>> >> set (updatedText, 'String', 'A')
>> >> %
>> >> words=get(listbox,'string'); %share this in a handle element
>> >> perhaps?
>> >> matchFlag = strcmp(updatedText,words);
>> >> firstMatchingIndex = find(matchFlag,1);
>> >> set(listbox,'Value',firstMatchingIndex);
>> Please review the code above once more.
>> Dont the last four lines do what you describe? (Do look up the
>> help/doc for STRCMP and FIND, it might help you gain additional
>> insights.)
>> (If not, please try explaining in some more detail)
>
> No. The last four lines just callback the words from the listbox to the
> text screen above it. So when I click on "Action" it pops up on the
> screen above it. Same for letters "A" through "Z". When I click on "B"
> it pops up on the text screen above it. All I want at this point,
> Ashish, is I need to correlate the letters "A" through "Z" on the
> pushbuttons to the words on the listbox. So if i click on "B"
> pushbutton, I need it to highlight the B words on the listbox so the
> user does not have to scroll all the way down to the B words. Please
> help me out Ashish and thanks so much for taking the time to consider my
> issue.

The last four lines of the code I posted.
From: Jan Simon on
Dear Writers!

Wouldn't it be easier to read without the cited cited cited citations?
And after we know:
B= uicontrol ('Style','PushButton','String','B','Position',[200,550, 130,80],...
'CallBack', @BPressed);
it might be smart *not* to post the code for "C", "D", etc.

Just an idea, because I'm too tired to dig in the heap of lines, which do not contain relevant information. But this might be my personal problem.

Thanks, Jan
From: riya sen on
"Ashish Uthama" <first.last(a)mathworks.com> wrote in message <op.va3vfj0ka5ziv5(a)uthamaa.dhcp.mathworks.com>...
> On Tue, 13 Apr 2010 11:11:10 -0300, riya sen <nehakalra_15(a)yahoo.com>
> wrote:
>
> > "Ashish Uthama" <first.last(a)mathworks.com> wrote in message
> > <op.va3ndbfea5ziv5(a)uthamaa.dhcp.mathworks.com>...
> >> On Mon, 12 Apr 2010 21:15:07 -0300, neha kalra
> >> <nehakalra_15(a)yahoo.com> wrote:
> >> > Thank you. I solved that issue thanks to your insight. However,
> >> finally > I need to correlate the letters A-Z to the words on the
> >> listbox. For > example, when I click on "A"pushbutton it should point
> >> to the first > alphabetical letter "A" in the listbox and vice versa
> >> for B. Here is the > current coding:
> >> >
> >> > function exampleGUI
> >> > Txt = uicontrol ('Style', 'edit','tag','editbox', 'Position', [300,
> >> 650, > 700, 60]);
> >> > A = uicontrol >
> >> ('Style','PushButton','String','A','Position',[50,550, 130, 80],...
> >> > 'CallBack', @APressed);
> >> > B= uicontrol >
> >> ('Style','PushButton','String','B','Position',[200,550, 130,80],...
> >> > 'CallBack', @BPressed);
> >> > C= uicontrol
> >> ('Style','PushButton','String','C','Position',[350,550, > 130,80],...
> >> > 'CallBack', @CPressed);
> >> > D= uicontrol
> >> ('Style','PushButton','String','D','Position',[500,550, > 130,80],...
> >> > 'CallBack', @DPressed);
> >> > E= uicontrol
> >> ('Style','PushButton','String','E','Position',[650,550, > 130,80],...
> >> > 'CallBack', @EPressed);
> >> > F= uicontrol
> >> ('Style','PushButton','String','F','Position',[800,550, > 130,80],...
> >> > 'CallBack', @FPressed);
> >> > G= uicontrol
> >> ('Style','PushButton','String','G','Position',[50,450, > 130,80],...
> >> > 'CallBack', @GPressed);
> >> > H= uicontrol
> >> ('Style','PushButton','String','H','Position',[200,450, > 130,80],...
> >> > 'CallBack', @HPressed);
> >> > I= uicontrol
> >> ('Style','PushButton','String','I','Position',[350,450, > 130,80],...
> >> > 'CallBack', @IPressed);
> >> > J= uicontrol
> >> ('Style','PushButton','String','J','Position',[500,450, > 130,80],...
> >> > 'CallBack', @JPressed);
> >> > K= uicontrol
> >> ('Style','PushButton','String','K','Position',[650,450, > 130,80],...
> >> > 'CallBack', @KPressed);
> >> > L= uicontrol
> >> ('Style','PushButton','String','L','Position',[800,450, > 130,80],...
> >> > 'CallBack', @LPressed);
> >> > M= uicontrol ('Style','PushButton','String','M','Position',[50,350,
> >> > 130,80],...
> >> > 'CallBack', @MPressed);
> >> > N= uicontrol
> >> ('Style','PushButton','String','N','Position',[200,350, > 130,80],...
> >> > 'CallBack', @NPressed);
> >> > O= uicontrol
> >> ('Style','PushButton','String','O','Position',[350,350, > 130,80],...
> >> > 'CallBack', @OPressed);
> >> > P= uicontrol
> >> ('Style','PushButton','String','P','Position',[500,350, > 130,80],...
> >> > 'CallBack', @PPressed);
> >> > Q= uicontrol
> >> ('Style','PushButton','String','Q','Position',[650,350, > 130,80],...
> >> > 'CallBack', @QPressed);
> >> > R= uicontrol
> >> ('Style','PushButton','String','R','Position',[800,350, > 130,80],...
> >> > 'CallBack', @RPressed);
> >> > S= uicontrol ('Style','PushButton','String','S','Position',[50,250,
> >> > 130,80],...
> >> > 'CallBack', @SPressed);
> >> > T= uicontrol
> >> ('Style','PushButton','String','T','Position',[200,250, > 130,80],...
> >> > 'CallBack', @TPressed);
> >> > U= uicontrol
> >> ('Style','PushButton','String','U','Position',[350,250, > 130,80],...
> >> > 'CallBack', @UPressed);
> >> > V= uicontrol
> >> ('Style','PushButton','String','V','Position',[500,250, > 130,80],...
> >> > 'CallBack', @VPressed);
> >> > W= uicontrol
> >> ('Style','PushButton','String','W','Position',[650,250, > 130,80],...
> >> > 'CallBack', @WPressed);
> >> > X= uicontrol
> >> ('Style','PushButton','String','X','Position',[800,250, > 130,80],...
> >> > 'CallBack', @XPressed);
> >> > Y= uicontrol ('Style','PushButton','String','Y','Position',[50,150,
> >> > 130,80],...
> >> > 'CallBack', @YPressed);
> >> > Z= uicontrol
> >> ('Style','PushButton','String','Z','Position',[200,150, > 130,80],...
> >> > 'CallBack', @ZPressed);
> >> > function APressed (h, eventdata)
> >> > set (Txt, 'String', 'A')
> >> > end; function BPressed (h, eventdata)
> >> > set (Txt, 'String', 'B');
> >> > end; function CPressed (h, eventdata)
> >> > set (Txt, 'String', 'C')
> >> > end; function DPressed (h, eventdata)
> >> > set (Txt, 'String', 'D');
> >> > end; function EPressed (h, eventdata)
> >> > set (Txt, 'String', 'E')
> >> > end; function FPressed (h, eventdata)
> >> > set (Txt, 'String', 'F');
> >> > end; function GPressed (h, eventdata)
> >> > set (Txt, 'String', 'G')
> >> > end; function HPressed (h, eventdata)
> >> > set (Txt, 'String', 'H');
> >> > end; function IPressed (h, eventdata)
> >> > set (Txt, 'String', 'I')
> >> > end; function JPressed (h, eventdata)
> >> > set (Txt, 'String', 'J');
> >> > end; function KPressed (h, eventdata)
> >> > set (Txt, 'String', 'K')
> >> > end; function LPressed (h, eventdata)
> >> > set (Txt, 'String', 'L');
> >> > end; function MPressed (h, eventdata)
> >> > set (Txt, 'String', 'M')
> >> > end; function NPressed (h, eventdata)
> >> > set (Txt, 'String', 'N');
> >> > end; function OPressed (h, eventdata)
> >> > set (Txt, 'String', 'O')
> >> > end; function PPressed (h, eventdata)
> >> > set (Txt, 'String', 'P');
> >> > end; function QPressed (h, eventdata)
> >> > set (Txt, 'String', 'Q')
> >> > end; function RPressed (h, eventdata)
> >> > set (Txt, 'String', 'R');
> >> > end; function SPressed (h, eventdata)
> >> > set (Txt, 'String', 'S')
> >> > end; function TPressed (h, eventdata)
> >> > set (Txt, 'String', 'T');
> >> > end; function UPressed (h, eventdata)
> >> > set (Txt, 'String', 'U')
> >> > end; function VPressed (h, eventdata)
> >> > set (Txt, 'String', 'V');
> >> > end; function WPressed (h, eventdata)
> >> > set (Txt, 'String', 'W')
> >> > end; function XPressed (h, eventdata)
> >> > set (Txt, 'String', 'X');
> >> > end; function YPressed (h, eventdata)
> >> > set (Txt, 'String', 'Y')
> >> > end; function ZPressed (h, eventdata)
> >> > set (Txt, 'String', 'Z');
> >> > end;
> >> > listbox = uicontrol ('style','listbox','units','normalized',...
> >> > 'Position',[.8, .4, .2 , >
> >> .46],'String',{'A';'Am';'Are';'Able';'Above';'According';'Account';'Across';...
> >> > 'Act';'Action';'Activity'; 'Actually'; >
> >> 'Added';'Addition';'After';'Again'; >
> >> 'Against';'Age';'Ago';'Ahead';'Aid';'Air';'All';'Almost';'Alone';...
> >> >
> >> 'Along';'Already';'Also';'Although';'Always';'And';'Another';'Answer';'Anti';'Anyone';'Any';'Anything';'Appear';'Approach';'Area';'Arms';...
> >> >
> >> 'Around';'Art';'Ask';'Asked';'attack';'Attention';'available';'Average';'Away';
> >> > 'B';'Bad';'Ball';'Based';'Basic';'Basis';'Be';'Beautiful';...
> >> >
> >> 'Became';'Because';'Become';'Bed';'Been';'Before';'Began';'Beginning';'Behind';'Being';'Believe';'Below';
> >> > 'Best';'Better';'Between';'Beyond';...
> >> >
> >> 'Big';'Bill';'Black';'Blood';'Blue';'Board';'Body';'Book';'Born';'Both';'Bring';'British';'Brought';'Brown';'Building';'Built';'Business';...
> >> > 'But';'By'});
> >> > % Define listbox Callback property to update edit box
> >> > set (listbox, 'Callback', @(src, evt) listCallback (src, Txt));
> >> > end
> >> > function listCallback (src, editBoxHandle)
> >> > % Get current selection number
> >> > value = get (src, 'Value');
> >> > % Get entire string array.
> >> > strArr = get (src,'String');
> >> > % Index into string array to retrieve selection
> >> > selection = strArr {value};
> >> > set (editBoxHandle, 'String', selection);
> >> > end
> >> >
> >> >
> >> >
> >> >
> >> > NOTE: I just have words from A-B on listbox, so basically I need to
> >> get > the basic idea for pushbuttons "A" and "B" and i can apply that
> >> all the > way down to Z. So saying once again, when you click on "A",
> >> it should > point to the first letter alphabetically and also when you
> >> click on "B", > it should point to "B" on listbox. Take care
> >> >
> >> >
> >> > "Ashish Uthama" <first.last(a)mathworks.com> wrote in message >
> >> <op.va2dy2p7a5ziv5(a)uthamaa.dhcp.mathworks.com>...
> >> >> On Sun, 11 Apr 2010 22:13:03 -0300, neha kalra >>
> >> <nehakalra_15(a)yahoo.com> wrote:
> >> >> > Copy and paste code into MATLAB m-fiLe and run it. Please help
> >> us >> out in > when u click on "A" for example, it should pop up an A
> >> on the >> screen > above it. Right now you can tell, when u click on
> >> the words >> on the > listbox, it pops up on the screen above it. I
> >> would like to >> have that > happen plus clicking on a letter from a
> >> pushbutton can pop >> a letter on > the screen. I will pay big bucks
> >> for anyone who can >> alter the code in > this manner ($100's) and
> >> please send it to >> nehakalra_15(a)yahoo.com.
> >> >> >
> >> >> Did you have a chance to look at the answer in your other thread?
> >> >> Replace
> >> >> function APressed (h, eventdata)
> >> >> set (Txt, 'String', 'A')
> >> >> with: (To append to existing text in the editbox, and update
> >> listbox >> text selection on right (warning: air code!)
> >> >> function APressed (h, eventdata)
> >> >> %append current pressed key char to string in editbox
> >> >> currentText = get(Txt,'String')
> >> >> updatedText = [currentText Txt];
> >> >> set (updatedText, 'String', 'A')
> >> >> %
> >> >> words=get(listbox,'string'); %share this in a handle element
> >> >> perhaps?
> >> >> matchFlag = strcmp(updatedText,words);
> >> >> firstMatchingIndex = find(matchFlag,1);
> >> >> set(listbox,'Value',firstMatchingIndex);
> >> Please review the code above once more.
> >> Dont the last four lines do what you describe? (Do look up the
> >> help/doc for STRCMP and FIND, it might help you gain additional
> >> insights.)
> >> (If not, please try explaining in some more detail)
> >
> > No. The last four lines just callback the words from the listbox to the
> > text screen above it. So when I click on "Action" it pops up on the
> > screen above it. Same for letters "A" through "Z". When I click on "B"
> > it pops up on the text screen above it. All I want at this point,
> > Ashish, is I need to correlate the letters "A" through "Z" on the
> > pushbuttons to the words on the listbox. So if i click on "B"
> > pushbutton, I need it to highlight the B words on the listbox so the
> > user does not have to scroll all the way down to the B words. Please
> > help me out Ashish and thanks so much for taking the time to consider my
> > issue.
>
> The last four lines of the code I posted.

I know. So if those lines you posted:

currentText = get(Txt,'String')
updatedText = [currentText Txt];
set (updatedText, 'String', 'A')

words=get(listbox,'string'); %share this in a handle element
matchFlag = strcmp(updatedText,words);
firstMatchingIndex = find(matchFlag,1);
set(listbox,'Value',firstMatchingIndex);


Where should i put this code in my m file? And you're certain this correlates pushing pushbutton "B" to the listbox words starting with B?
From: riya sen on
Just to make things easier, Ashish, please just post some code about how I can correlate the push button "B" to the list box, not the text screen at the top, but the listbox. How can, for example, when I click "B", it can go to the word "Basic."

That's all I'm asking. Please help me.
From: riya sen on
"riya sen" <nehakalra_15(a)yahoo.com> wrote in message <hq24pu$f6v$1(a)fred.mathworks.com>...
> Just to make things easier, Ashish, please just post some code about how I can correlate the push button "B" to the list box, not the text screen at the top, but the listbox. How can, for example, when I click "B", it can go to the word "Basic."
>
> That's all I'm asking. Please help me.


Ok i put it in here...


function BPressed (h, eventdata)
listbox = uicontrol ('style','listbox','units','normalized',...
'Position',[.8, .4, .2 , .46],'fontsize', 30, 'String',{'A';'Am';'Are';'Able';'Above';'According';'Account';'Across';...
'Act';'Action';'Activity'; 'Actually'; 'Added';'Addition';'After';'Again'; 'Against';'Age';'Ago';'Ahead';'Aid';'Air';'All';'Almost';'Alone';...
'Along';'Already';'Also';'Although';'Always';'And';'Another';'Answer';'Anti';'Anyone';'Any';'Anything';'Appear';'Approach';'Area';'Arms';...
'Around';'Art';'Ask';'Asked';'attack';'Attention';'available';'Average';'Away'; 'B';'Bad';'Ball';'Based';'Basic';'Basis';'Be';'Beautiful';...
'Became';'Because';'Become';'Bed';'Been';'Before';'Began';'Beginning';'Behind';'Being';'Believe';'Below'; 'Best';'Better';'Between';'Beyond';...
'Big';'Bill';'Black';'Blood';'Blue';'Board';'Body';'Book';'Born';'Both';'Bring';'British';'Brought';'Brown';'Building';'Built';'Business';...
'But';'By'});

set (Txt, 'String', 'B')
words=get(listbox,'string', {'Basic'});
matchFlag = strcmp(Txt);
firstMatchingIndex = find(matchFlag,7);
set(listbox,'Value',firstMatchingIndex);

Whenever i click on "B" pushbutton, the listbox flashes, meaning we're on the right track. However i need it to get to "Basic". That's what i need help with.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Read Image to Matrix in Simulink
Next: Maple or Mupad?