Prev: power system studies
Next: need help about xcorr
From: Bruno Luong on 23 Apr 2010 12:35 Walter Roberson <roberson(a)hushmail.com> wrote in message <hqsh31$jo1$1(a)canopus.cc.umanitoba.ca>... > > It has been noted by some users that in at least some versions Could be, but OP's ML version is 2007a and it does surely not suffer this bug according to my test (generated by either uicontrol or guide). Bruno
From: Jan Simon on 23 Apr 2010 13:03 Dear Marc Crapeau! > Just change your "if var1==0" with "if var1==0 | isempty(var1)" Although the behaviour equals the expectations if var1 is the empty matrix, I would not use it. The replies for the following statements are equal, if var1 is empty: if var1 == 0 | isempty(var1), disp('TRUE'); end if var1 == 0 | ~isempty(var1), disp('TRUE'); end Both evaluate: if [] | anything which is equal to: if [] Better use: if any(var1) However, Bruno hits the point: The OPs problem is not the checkbox, but his program uses a global variable, which is not initialized correctly if the callback of the checkbox has not been called (twice). The solution is to create a possibility to identify the checkbox and check the value when the program starts - e.g. by storing its handle in the figures UserData or using the unique tag name of the checkbox. Good luck, Jan
From: Walter Roberson on 23 Apr 2010 15:28 Bruno Luong wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <hqsh31$jo1$1(a)canopus.cc.umanitoba.ca>... >> >> It has been noted by some users that in at least some versions > > Could be, but OP's ML version is 2007a and it does surely not suffer > this bug according to my test (generated by either uicontrol or guide). I am unable to verify this myself, as our 2007a license files have been cleaned up out of existence. (Q: What's the difference between a hot young hacker and an old-before-their-time software engineer? A: the hot young hacker says "If I ever need this kind of code again, I'll re-write it from scratch: that'll be faster and more interesting", whereas the worn software engineer says "Don't delete that old tool; I may need it later to do regression testing or to support a customer with an older version!, and I need to ensure that our program produces the same answers for the old tool version and the new tool version!) What I can say is that Rakesh posted approximately March 29 specifically indicaing he was having this difficulty with 2007a. That was the "Oh God, I wish that Walter Roberson would tell me how to..." post.
From: Rajesh on 3 May 2010 04:52
Ahem ahem.... If i may dare to interrupt a family discussion, @Bruno, >For example such error happens as following: "var1" would never set if you the callback is >not invoked, so it remains empty. This is programming error because you don't fully >understand the data flow of your program and GUI callback mechanism. My question: why would a user invoke the callback fn of a checkbox if it is in the desired state. i assume here that the callback is invoked only when i click the box. i've already said that when i do so it works but why should i be required to do it. Now another question: is there another way of doing it? answer: i dont know (novice afterall) I am not trying to prove that its a bug. I dont care. I need to resolve this issue. period. @Jan >The solution is to create a possibility to identify the checkbox and check the value when the program starts - e.g. by storing its handle in the figures UserData or using the unique tag name of the checkbox. thanks a million. Can u elaborate. how to store the handle in user data? OR How to use the unique tag name to set the value of my variable "var1" without interupting the checkbox? @ Walter, thanks for the support. Again, I dont wish to win an argument here (bug or no bug) just want a solution. Wonder what happens to the "hot young hacker" when he grows old. |