Workspace not saving - just disappearing!

28 ビュー (過去 30 日間)
10B 2015 年 9 月 28 日
コメント済み: 10B 2015 年 9 月 28 日
Hello Community,
I dont understand what is happening here. I am using a line of code to save my workspace - however what happens is the saved workspace doesnt get created, the dialogue box just disappears and nothing is saved. Code as:
[file,path] = uiputfile('*.mat','Save Workspace As');
so when I call this and fill in the filename in the dialogue box - nothing gets saved at all. Variables 'file' and 'path' are created and are added to the workspace, but a copy of all the variables contained in the workspace under a '.mat' file is not created or added to the current parent folder.
Any ideas as to whats going on here?


Star Strider
Star Strider 2015 年 9 月 28 日
編集済み: Star Strider 2015 年 9 月 28 日
From the documentation:
  • Note: Successful execution of uiputfile does not create a file; it only returns the name of a new or existing file that you designate.
Add these lines after the uiputfile call:
pf = fullfile(path, file); % Combines ‘path’ & ‘file’
save(pf); % Saves Workspace
(I did not test this code, but it should work.)
  7 件のコメント
10B 2015 年 9 月 28 日
Hello Image Analyst,
Yes, thanks for the explanation. I hadn't thought of that as a process - but it makes sense.
I had made changes to the script yes, but not in a way that effected this part of the code - or at least so I thought!
Unfortunately, I overwrote the code so I can't go back to confirm the changes, but there you go, another lesson learnt for next time.


その他の回答 (0 件)


Community Treasure Hunt

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

Start Hunting!

Translated by