First time here? Check out the FAQ!

Ask Your Question
0

Save and retrieving my data

asked 11 years ago

geo909 gravatar image

I often compute things that take a lot of time. When I stop working, I have to turn off my laptop. When I resume my work later, I'd like to be able to retrieve the previous data, computations, etc. For instance, I have computed a big list and stored it to the variable x. I would like to be able to save my data including the contents of this variable, then when I resume my work, I'd like to be able to have x back.

I tried to save my data to a file mydata.dat via the Data -->Upload or create file menu. Then, I quit sage, ran it again, and tried to link the data file back via the same menu. I got the following:

The data filename already exists in other worksheet Delete the file in the other worksheet before creating a link.

I don't really understand what that means. Then, I tried all of the following:

DATA+'mydata.dat'
open(DATA+'mydata.dat')
DATA=DATA+'mydata.dat'

but in any case, if I type x, I get

NameError: name 'x' is not defined

Could somebody tell me how I should achieve what I'm trying?

Preview: (hide)

3 Answers

Sort by » oldest newest most voted
0

answered 11 years ago

calc314 gravatar image

You can write the data to a csv file in the DATA directory. I do this regularly with my applications. You can find some code for this at:

http://ask.sagemath.org/question/2154...

Preview: (hide)
link
0

answered 11 years ago

Jeroen Demeyer gravatar image
Preview: (hide)
link

Comments

Thanks, that's probably what I'd have to go with. However, I was wondering if there is a way to save all the data of a specific worksheet without having to explicitely save every variable to a file. I may have too many of them. Isn't that what the data files were supposed to do?

geo909 gravatar imagegeo909 ( 11 years ago )

In particular, note `load`.

kcrisman gravatar imagekcrisman ( 11 years ago )

@kcrisman Thanks, but I have the same problem with that; I'd have to save each variable seperately, I may have 100 of them and would like to save the data for the whole worksheet lazily..

geo909 gravatar imagegeo909 ( 11 years ago )
0

answered 11 years ago

kcrisman gravatar image

Can you use the save_session command?

Preview: (hide)
link

Comments

1

From a first look, it seems that this is probably what I was asking for in the first place.

geo909 gravatar imagegeo909 ( 11 years ago )

Awesome. In that event, don't forget to up vote this and/or accept it, so that others will know it's what you meant.

kcrisman gravatar imagekcrisman ( 11 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 1,455 times

Last updated: Feb 16 '14