MATLAB: How to save to mat file

save to mat files

Hi All,
I am having some problem now and need to solve it urgently. Please help.
imep=W4/(pi*b^2/4*s);
eta=W4/mass1*(1+phi*0.06548*(1-f))/phi/0.06548/(1-f)/47870/1e3;
timefinish=cputime;
timetaken=timefinish-timestart;
% save all data
save ahrind.mat
clear
I am having some error.
*Error using save Unable to write file ahrind.mat: permission denied.
Error in ahrind (line 80) save ahrind.mat *
Can I know how can I save the file to mat format.
Thanks.

Best Answer

Looks like you're trying to save a file to either, an open file (try "fclose all"), or a file location that you do not have permission to write to.
If someone else has the file open, "fclose all" will do nothing. If you don't have write access, you need to talk to your admin. - But you should be able to save it somewhere only you can see, like:
save 'D:\my document folder\matlab stuff\test.mat'