Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
Math Forum
»
Discussions
»
Software
»
comp.soft-sys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
How to update a public property in a method of the class
Replies:
5
Last Post:
Jul 15, 2014 10:14 AM
|
 |
|
|
How to update a public property in a method of the class
Posted:
Jul 11, 2014 12:03 PM
|
|
Hi Folks,
I have a class object QG initialised as gr = QG(constructor). It has a public property gr.spectrum which is initialised to [] at the start. I dont know if this is necessary, but I create a set method for spectrum, and set gr.spectrum = A_Vector externally (that is the value is set using the method set.spectrum(argument)).
Then there is a method function of gr.doesSomething that does some stuff and within the method, according to an if statement, the method imperatively needs to update the property QG.spectrum within, and the updated property has to be accessed after the if statement by declarations in the method.
I check that the property QG.spectrum (as it is declared in the method making use of the property) has indeed updated in the method by printing out the new size of the property, and the latter always suggests it has. The trouble is that, if I then call gr.spectrum externally on the matlab workspace, it returns the non updated vector, and some of the other methods that rely on the updated vector do not seem to work because the sizes are not consitent. What is going on? Why is the property vector not really updated?
Help appreciated thanks
|
|
|
|