help using Save and load function

2 次查看(过去 30 天)
oselu
oselu 2014-8-20
评论: oselu 2014-8-20
Hello I would like to save a variable into a .dat file using the command window but my save function is now working. I have followed the example from my tutorial book but they are not working.
I would like to save the file and then load it again from the command window. I am currently using R2010a.
all assistance is greatly appreciated thank you
  4 个评论
oselu
oselu 2014-8-20
x=1:2:10
save ('"C:\Users\user\Documents\MATLAB\test.dat','x','-ascii')
??? Error using ==> save
Unable to write file "C:\Users\user\Documents\MATLAB\test.dat: Invalid argument.
>>
oselu
oselu 2014-8-20
I figured it out Geoff thank you very much

请先登录,再进行评论。

回答(1 个)

Max Müller
Max Müller 2014-8-20
编辑:Max Müller 2014-8-20
I had this Problem once before (i guess). Try to save ur Variable in a .mat file and then load it again. Just try it. Loading form a .dat file is somehow complicated.
X = 1
save('Test.mat','X') % save into the file: Test.mat
clear % deletes all the Variables it the Workspace
load('Test.mat','X') % gives back ur Variable X
  5 个评论
oselu
oselu 2014-8-20
a =
2
>> save ('"C:\Users\user\Documents\MATLAB\test.dat','a','-ascii') ??? Error using ==> save Unable to write file "C:\Users\user\Documents\MATLAB\test.dat: Invalid argument.
>>
oselu
oselu 2014-8-20
I figured it out thank you very much Adam

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by