Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: go to next function in one callback?

Subject: go to next function in one callback?

From: ching l

Date: 17 Jul, 2008 10:19:02

Message: 1 of 9

In Gui, how do I command the callback function to go to the
next function?

For example, when I first press the button, it will go to this,


function answer_faster_Callback(hObject, eventdata, handles)
csvwrite('subject1.dat',[1;00;55]);


then when I press again, it will go to this,

csvwrite('subject2.dat',[3;5;6]);


Possible to do that?

Thanks.

Subject: go to next function in one callback?

From: David

Date: 17 Jul, 2008 13:53:02

Message: 2 of 9

"ching l" <chinglnc@hotmail.com> wrote in message
<g5n6am$78p$1@fred.mathworks.com>...
> In Gui, how do I command the callback function to go to
the
> next function?
>
> For example, when I first press the button, it will go
to this,
>
>
> function answer_faster_Callback(hObject, eventdata,
handles)
> csvwrite('subject1.dat',[1;00;55]);
>
>
> then when I press again, it will go to this,
>
> csvwrite('subject2.dat',[3;5;6]);
>
>
> Possible to do that?
>
> Thanks.

yes, just save where you ere in the handles or a global
variable and do the next thing each time.

Subject: go to next function in one callback?

From: ching l

Date: 17 Jul, 2008 14:18:02

Message: 3 of 9

> yes, just save where you ere in the handles or a global
> variable and do the next thing each time.

Sorry, don't really get it..

a little bit more details please?

Subject: go to next function in one callback?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 18 Jul, 2008 21:41:16

Message: 4 of 9

In article <g5n6am$78p$1@fred.mathworks.com>,
ching l <chinglnc@hotmail.com> wrote:
>In Gui, how do I command the callback function to go to the
>next function?

>For example, when I first press the button, it will go to this,

>function answer_faster_Callback(hObject, eventdata, handles)
>csvwrite('subject1.dat',[1;00;55]);

>then when I press again, it will go to this,

>csvwrite('subject2.dat',[3;5;6]);

>Possible to do that?

Yes,

function answer_faster_Callback(hObject, eventdata, handles)
  persistent fargs
  if isempty(fargs)
    fargs.args = {{'subject1.dat',[1;00;55]}, {'subject2', [3;5;6]}, ...
                  {'subject3.dat',[17;8;21]}, {'subject4', [255;0;255]};
    fargs.count = 1;
  end

  csvwrite(fargs.args{fargs.count,1}, fargs.args{fargs.count,2});
  fargs.count = fargs.count + 1;
  if fargs.count > length(fargs.args)
     set(hObject, 'Callback', '');
  end
end
--
Q: Why did the chicken cross the Mobius strip?

A: There were manifold reasons.

Subject: go to next function in one callback?

From: ching l

Date: 22 Jul, 2008 05:52:01

Message: 5 of 9

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g5r2ls$4l8$1@canopus.cc.umanitoba.ca>...
> In article <g5n6am$78p$1@fred.mathworks.com>,
> ching l <chinglnc@hotmail.com> wrote:
> >In Gui, how do I command the callback function to go to the
> >next function?
>
> >For example, when I first press the button, it will go to
this,
>
> >function answer_faster_Callback(hObject, eventdata, handles)
> >csvwrite('subject1.dat',[1;00;55]);
>
> >then when I press again, it will go to this,
>
> >csvwrite('subject2.dat',[3;5;6]);
>
> >Possible to do that?
>
> Yes,
>
> function answer_faster_Callback(hObject, eventdata, handles)
> persistent fargs
> if isempty(fargs)
> fargs.args = {{'subject1.dat',[1;00;55]}, {'subject2',
[3;5;6]}, ...
> {'subject3.dat',[17;8;21]}, {'subject4',
[255;0;255]};
> fargs.count = 1;
> end
>
> csvwrite(fargs.args{fargs.count,1},
fargs.args{fargs.count,2});
> fargs.count = fargs.count + 1;
> if fargs.count > length(fargs.args)
> set(hObject, 'Callback', '');
> end
> end
> --
> Q: Why did the chicken cross the Mobius strip?
>
> A: There were manifold reasons.


I got some changes of this...not very sure how to work it out...

Is it possible to retain the previous value of the callback?
something like this, but I know this is not right. I want
the callback to store the previous count value and store in
current count value

handles.s {counter} = [(handles.id), (handles.randValue), 2]

handles.scount= 1
handles.scount= handles.scount +1 ;

handles.s= [handles{count}, handles{count-1};]

so let say handles.s {1} = [1, 2, 3];
           handles.s {2} = [4, 5, 6]; handles {1};
           handles.s {3} = [7, 8, 9]: handles {2};
             

so on and so forth...



Subject: go to next function in one callback?

From: dreammissu

Date: 22 Jul, 2008 08:20:51

Message: 6 of 9

This would set up network address, then to return to the kind of data transmission, is how the application of this » That this is the first to write themselves a callback function, and then set up the callback function to libcurl Curry, and then specify what kind of format to receive data, when libcurl to return to the data will set the callback function. Are as follows:
Callback function definitions:
size_t write_data (void * buffer, size_t size, size_t nmemb, void * userp);
Set up a callback function:
curl_easy_setopt (easyhandle, CURLOPT_WRITEFUNCTION, write_data);
Set up a callback function to receive the data format:
curl_easy_setopt (easyhandle, CURLOPT_WRITEDATA, & internal_struct);
 
Through the above settings, you can receive data to the callback function inside, then how is the kind libcurl command to start the download data or upload the data? » Below on the function curl_easy_perform, this function is to connect remote sites, began operating agreements related to the order, calling the examples are as follows:
success = curl_easy_perform (easyhandle);
 
Above through a series of calls, you can connect with the HTTP server and download the data and reached in the callback function. When finished using the library after this, do not forget to call functions curl_global_cleanup () to do the removal work.


[url=http://www.kakasoft.com/]file encryption[/url]

Subject: go to next function in one callback?

From: ching l

Date: 22 Jul, 2008 09:09:03

Message: 7 of 9

"ching l" <chinglnc@hotmail.com> wrote in message
<g63si1$5h5$1@fred.mathworks.com>...
> roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> message <g5r2ls$4l8$1@canopus.cc.umanitoba.ca>...
> > In article <g5n6am$78p$1@fred.mathworks.com>,
> > ching l <chinglnc@hotmail.com> wrote:
> > >In Gui, how do I command the callback function to go to the
> > >next function?
> >
> > >For example, when I first press the button, it will go to
> this,
> >
> > >function answer_faster_Callback(hObject, eventdata,
handles)
> > >csvwrite('subject1.dat',[1;00;55]);
> >
> > >then when I press again, it will go to this,
> >
> > >csvwrite('subject2.dat',[3;5;6]);
> >
> > >Possible to do that?
> >
> > Yes,
> >
> > function answer_faster_Callback(hObject, eventdata, handles)
> > persistent fargs
> > if isempty(fargs)
> > fargs.args = {{'subject1.dat',[1;00;55]}, {'subject2',
> [3;5;6]}, ...
> > {'subject3.dat',[17;8;21]}, {'subject4',
> [255;0;255]};
> > fargs.count = 1;
> > end
> >
> > csvwrite(fargs.args{fargs.count,1},
> fargs.args{fargs.count,2});
> > fargs.count = fargs.count + 1;
> > if fargs.count > length(fargs.args)
> > set(hObject, 'Callback', '');
> > end
> > end
> > --
> > Q: Why did the chicken cross the Mobius strip?
> >
> > A: There were manifold reasons.
>
>
> I got some changes of this...not very sure how to work it
out...
>
 Is it possible to retain the previous value of the
callback? something like this, but I know this is not right.
I want the callback to store the previous count value and
store in current count value


handles.scount= 1;
handles.scount= handles.scount+1;

handles.sc{handles.scount}= [handles.id,
(handles.randValue), 2]

handles.s = [handles.sc{handles.scount};
handles.sc{handles.scount-1}]

guidata(hObject, handles);


it still doesn't return the previous count value..any idea how?

Subject: go to next function in one callback?

From: Peter Boettcher

Date: 22 Jul, 2008 13:41:12

Message: 8 of 9

"ching l" <chinglnc@hotmail.com> writes:

> Is it possible to retain the previous value of the
> callback? something like this, but I know this is not right.
> I want the callback to store the previous count value and
> store in current count value
>
>
> handles.scount= 1;
> handles.scount= handles.scount+1;
>
> handles.sc{handles.scount}= [handles.id,
> (handles.randValue), 2]
>
> handles.s = [handles.sc{handles.scount};
> handles.sc{handles.scount-1}]
>
> guidata(hObject, handles);
>
>
> it still doesn't return the previous count value..any idea how?

Get rid of the semicolons so you can see what's happening. Look at the
all the values on each click, figure out what isn't changing the way you
want, fix it, and try again.

-Peter

Subject: go to next function in one callback?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 22 Jul, 2008 14:12:31

Message: 9 of 9

In article <8001046.1216714882627.JavaMail.jakarta@nitrogen.mathforum.org>,
dreammissu <yushun1988829@gmail.com> wrote:
>This would set up network address, then to return to the kind of data
>transmission, is how the application of this

dreammissu, is that a reply to the previous discussion, or did you happen
to start a new discussion under an old title? If you were starting
a new discussion, then I could not make out what your question was?
--
  "What is important, then, is not that the critic should possess a
  correct abstract definition of beauty for the intellect, but a
  certain kind of temperament, the power of being deeply moved by
  the presence of beautiful objects." -- Walter Pater

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
callback ching l 17 Jul, 2008 10:20:28
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics