In the following matlab code,
random_numbers = randn(1,1000);
j=1;
for i=1:length(random_numbers)
if random_numbers(i) > 2.0
extracted(j) = random_numbers(i);
j = j + 1;
end
end
save 'sample1' extracted
we get the following error:
??? error ==> save
Unable to write file sample1: permission denied.
error ==> test at 9
save 'sample1' extracted
Please advise.
A
permission deniederror would suggest that you are trying to save to a directory to which you do not have write permission. Since you have specified just a base name for the filename,savewill try to save the MAT-file to the current working directory, which you can determine by running the commandpwd. You can also check the permissions of the current directory by runningand inspecting the
UserWritefield of the returnedmessage.