class corruption

2 views (last 30 days)
Angus
Angus on 21 Feb 2012
Edited: Matt J on 20 Oct 2013
Hi all,
I have a set of classes all of which inherit the handle class. For simplicity I'll focus on the stock class and the portfolio class.
The stock class has a set properties that define a stock (ticker, shares, prices, etc).
The portfolio class has a set of properties that define the portfolio at a given point in time (holding date, holdings (cell array of stock objects), marketvalue, etc.).
I have a simulation where I give portfolio a starting portfolio of stock. The constructor still works and I can populate an initial portfolio port with 50 stocks. I have two methods that invest and divest (buy and sell) stocks as I walk forward in time and feed it a list of stock objects to add or remove. The following is the invest method.
function investStock(obj, stockobj) obj.holdings(end+1) = {stockobj}; end
Until 8:0am today I was able to simulate through and have my initial portfolio adjust through time to a set of buys and sells and end up with the final portfolio being the cumulative sum of buys and sell. Everything was working perfectly and I had tested each method, each bit of code as I added it. I disconnected my computer at home, brought it to work, made ZERO changes to the code and now it does not work.
It appears as if the classes / matlab have become corrupted. I've shut down and restarted to clear out memory. No luck. I deleted the asv files. Again nothing. Does matlab keep a copy of my classes resident somewhere or does anyone have any clue as to what might have happened?
I had a former colleague who had something similar happen in the past an he was also stumped and completely reinstalled matlab, which seems like a drastic solution.
Regards
  1 Comment
per isakson
per isakson on 22 Feb 2012
Any error messages? What happens when it "does not work"?

Sign in to comment.

Answers (1)

Angus
Angus on 21 Feb 2012
As some additional information on this problem, I tried completely recreating the class files, named as something else; e.g. StockNEW, portfolioNEW, etc. I didn't do a save as but copy-patste the text into a new file and modified.
All objects should be of a new file type and thus shouldn't be effected by any possible corruption within matlab resident in memory. Nothing. Same exact problem.
Any idea or help would be greatly appreciated.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!