i want save the table in file on my computer , i wrote the following but display error ? what should i do ?

2 次查看(过去 30 天)
save Table3; fname='newfile.xlsx'; xlswrite(fname,Table3);
Error using save Unable to write file Table3: permission denied.
Error in two (line 261) save Table3;

回答(2 个)

Jan
Jan 2017-1-30
You do not have write permissions in the current folder. This is solved by specifiying a valid folder:
folder = tempdir;
fname = fullfile(folder, 'newfile.xlsx');
save(fname, 'Table3');
  4 个评论
mohammed elmenshawy
i wrote folder = tempdir; fname = fullfile(folder, 'newfile.xlsx'); save(fname, 'Table3'); file_location = which('newfile.xlsx') and the file that contains the table does not appear after
Jan
Jan 2017-1-31
@mohammed: The file is saved in the folder, which is defined by the tempdir command. Type this in the command window:
tempdir
Of course you can use any otehr folder also, but I could not guess which folder you want. Therefore I've chosen tempdir as example:
folder = 'C:\Data\YourFolder\xyz;
fname = fullfile(folder, 'newfile.xlsx');
save(fname, 'Table3');
You can use uigetfolder also to select a folder in a GUI, or the output of userpath.

请先登录,再进行评论。


Peter Perkins
Peter Perkins 2017-1-31
Also, if you mean "table" as in the data type whose class is table, don't use xlswrite, use writetable.

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by