| MATLAB Central > MATLAB Newsreader > calling a function when a class is loaded for t... |
|
|
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 14 Nov, 2009 18:31:01 Message: 1 of 25 |
|
Is there a way to call a function when a class is loaded for the first time? |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 14 Nov, 2009 21:55:03 Message: 2 of 25 |
|
"Timothee " <timothee.cour_remove_these_@gmail.com> wrote in message <hdmt15$lo2$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 15 Nov, 2009 02:11:03 Message: 3 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hdn8vn$1q0$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Loren Shure Date: 16 Nov, 2009 14:37:14 Message: 4 of 25 |
|
In article <hdmt15$lo2$1@fred.mathworks.com>, |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 16 Nov, 2009 14:50:19 Message: 5 of 25 |
|
Loren Shure <loren.shure@mathworks.com> wrote in message <MPG.256b2da21e3d248d989a74@news.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Rich Ellis Date: 16 Nov, 2009 19:23:06 Message: 6 of 25 |
|
How about something like this: |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 16 Nov, 2009 20:05:19 Message: 7 of 25 |
|
"Rich Ellis" <rich@mathworks.com> wrote in message <hds8qs$t4v$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 16 Nov, 2009 20:45:20 Message: 8 of 25 |
|
"Timothee " <timothee.cour_remove_these_@gmail.com> wrote in message <hdsb9v$6qv$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 16 Nov, 2009 21:38:02 Message: 9 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hdsdl0$38a$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 16 Nov, 2009 21:41:01 Message: 10 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hdsdl0$38a$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 17 Nov, 2009 16:22:19 Message: 11 of 25 |
|
"Timothee " <timothee.cour_remove_these_@gmail.com> wrote in message <hdsgtd$qe5$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 17 Nov, 2009 16:37:22 Message: 12 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hduijr$qch$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 25 Nov, 2009 10:41:04 Message: 13 of 25 |
|
"Timothee " <timothee.cour_remove_these_@gmail.com> wrote in message <hdujg2$nud$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Timothee Date: 25 Nov, 2009 12:29:05 Message: 14 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hej1k0$o5c$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 25 Nov, 2009 12:40:21 Message: 15 of 25 |
|
"Timothee " <timothee.cour_remove_these_@gmail.com> wrote in message <hej7uh$j1u$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 25 Nov, 2009 13:06:04 Message: 16 of 25 |
|
"Matt " <xys@whatever.com> wrote in message <hej8jl$1m$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Steven Lord Date: 26 Nov, 2009 22:14:10 Message: 17 of 25 |
|
|
|
Subject: calling a function when a class is loaded for the first time From: Matt Date: 26 Nov, 2009 22:23:03 Message: 18 of 25 |
|
"Steven Lord" <slord@mathworks.com> wrote in message <hemuh5$ou0$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Steven Lord Date: 28 Nov, 2009 04:16:27 Message: 19 of 25 |
|
|
|
Subject: calling a function when a class is loaded for the first time From: Matt J Date: 28 Nov, 2009 15:12:03 Message: 20 of 25 |
|
"Steven Lord" <slord@mathworks.com> wrote in message <heq84d$re6$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Matt J Date: 28 Nov, 2009 15:33:06 Message: 21 of 25 |
|
"Steven Lord" <slord@mathworks.com> wrote in message <heq84d$re6$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Steven Lord Date: 28 Nov, 2009 23:34:05 Message: 22 of 25 |
|
|
|
Subject: calling a function when a class is loaded for the first time From: Wesley Date: 29 Nov, 2009 10:13:04 Message: 23 of 25 |
|
The other posters were close to what I think is the best answer. The trick is that the dummy property initializer should be for a static property: |
|
Subject: calling a function when a class is loaded for the first time From: Matt J Date: 29 Nov, 2009 12:55:06 Message: 24 of 25 |
|
"Wesley " <not.an.email@example.com> wrote in message <hethff$cpq$1@fred.mathworks.com>... |
|
Subject: calling a function when a class is loaded for the first time From: Wesley Date: 30 Nov, 2009 11:21:18 Message: 25 of 25 |
|
Just like SayHello is a static method of the class, onInitDummy is a static property of the class (as opposed to an instance property). (Note that because all static properties are read-only in MATLAB, they use the Constant attribute instead of the Static attribute.) |
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 |
| obscure behavior | Matt J | 29 Nov, 2009 07:59:54 |
| oop | per isakson | 16 Nov, 2009 15:11:08 |
| load | Timothee | 14 Nov, 2009 13:34:03 |
| class | Timothee | 14 Nov, 2009 13:34:03 |
| persistent | Timothee | 14 Nov, 2009 13:34:03 |
| static | Timothee | 14 Nov, 2009 13:34:03 |
Contact us at files@mathworks.com
