Info
This question is closed. Reopen it to edit or answer.
Storing a Finite Difference History
1 view (last 30 days)
Show older comments
Is there a good way to store finite difference history. I initially tried getframe() but that required that the frame actually pop up, which prohibited me from using the computer while the simulation was running. I next turned to making a 3 dimensional matrix but this requires a ton of memory, even if I store the values as singles rather than doubles. It's been pretty tedious to recalculate how much memory I'll be using every time I change a parameter on the simulation. Last time I ran it, it ran 8 hours before erroring out with a memory error. I don't really even understand why because I pre declared my history variable: basically
Hist = zeros(251,251,400);
which took fine, but then errored hours into the program when saving a time frame e.g.:
Hist(:,:,I) = NewMap;
where I is still less than 400;
So I've kind of got a problem and a half here. I have a memory problem that I'd like to find a new way around altogether, but I'd also like to understand why I'm getting this memory error to begin with.
Thanks, Jason
5 Comments
Answers (1)
Dr. Seis
on 31 Oct 2011
It may be more time consuming, but if you could code something up to simply write out the results to a text file (or binary file) then you at least have a copy of what was done and all would not be lost. You could even set it up to pick up where it left off if for some reason the run bombs (and you still think the prior results in the history are valid).
5 Comments
Dr. Seis
on 7 Nov 2011
There are other ways to write out a matrix to a txt file in a way that you can append the next, say, 4x4 matrix to the the bottom of the file. For example, each line you print out to the file could be the 16 elements of your matrix. Afterwards, you can visualize that data by pulling out a sub-set of rows and reconstruct to the original 4x4 matrix.
If you want to use something like "getframe" but without a figure/frame popping up, then check out "im2frame" in the help navigation window. If you can figure out how to make an indexed image, then you can basically save each frame without having those pesky figure/frames pop up.
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!