필터 지우기
필터 지우기

Strange error which appears running on WINDOWS, but not linux

조회 수: 5 (최근 30일)
Ilan levine
Ilan levine 2011년 7월 1일
I am a beginner at Matlab and I have written a function which seems to work when a colleague runs it on linux, but when I run it on my windos PC I get the following error at random points in my event loop. (function tacked on below)
Perhaps relevant comments about the data: There are 95 events in all, each event has time/voltage readings from three transducers with 20,000 data points from each transducer for each event.
I wonder if I am accidentally doing something bad in terms of memory usage. The error message is:
??? Error using ==> print>LocalPrint at 286
C:\Users\ilevine\AppData\Local\Temp\tpf8232741_5a20_4d50_8ad0_9ae4a3d3d2c9.ps:
Cannot open file: permission denied.
Error in ==> print at 228
LocalPrint(pj);
Error in ==> readf6 at 63
print('-dpdf',cur);
Many thanks if you can help!
Ilan Levine
The function is:
function h=readf6(~)
%Read in files from Ubi, store in vectors, find average and sigma of
%pretrigger data, overplot waveforms of each piezo in same window. v4,
%looped and amde input name variuation. 5 outputs all 95 figures
av=0;
sig=0;
vmax = zeros(3,1);
%
t= 5e-7:5e-7:0.01;
%subplot(3,1,1)
% Convert number to string to make filenames. Different branches for different powers of 10.
isnine=0;
for n=1:95
% isnine=isnine+1;
str=num2str(n);
if(n<10)
fn=['00',str];
elseif(n<100)
fn=['0',str];
else
fn=str;
end
% disp(fn)
cur=['C:\Users\ilevine\Desktop\lt2\from_ubi\currentpiezo\',fn,'.txt'];
%disp(cur)
fnA{n}=cur;
%disp(fnA(n))
data = importdata(cur);
v1=data(:,2);
v1a=abs(v1);
v1m=max(v1a);
cur=['C:\Users\ilevine\Desktop\lt2\from_ubi\newpiezo1\',fn,'.txt'];
data = importdata(cur);
v2=data(:,2);
v2a=abs(v2);
v2m=max(v2a);
cur=['C:\Users\ilevine\Desktop\lt2\from_ubi\newpiezo2\',fn,'.txt'];
data = importdata(cur);
v3=data(:,2);
v3a=abs(v3);
v3m=max(v3a);
if((v1m>v2m)&(v1m>v3m))
vmax(1)=vmax(1)+1;
elseif ((v2m>v1m)&(v2m>v3m))
vmax(2)=vmax(2)+1;
disp(2)
disp(n)
else
vmax(3)=vmax(3)+1;
disp(3)
disp(n)
end
h1=plot(t,v1,t,v2,t,v3);
legend('current piezo','newpiezo1','newpiezo2');
axis([0,0.01,-5,5]);
xlabel('Time(s)');ylabel('Potential(V)');
N=num2str(n);
Event=['Event ',N];
title(Event);
cur=['C:\Users\ilevine\Desktop\lt2\from_ubi\zfigures\fig',N,'.pdf'];
print('-dpdf',cur);
% if(isnine==9)isnine=0;
% end
end
disp(vmax)
%Next end is end of function
end

답변 (3개)

Paulo Silva
Paulo Silva 2011년 7월 1일
Looks like something is blocking the access to the file, maybe it's some kind of software protection, Antivirus maybe?
  댓글 수: 1
Ilan levine
Ilan levine 2011년 7월 1일
Thanks Paulo. I don't think that tis is it. Sometimes the routine processes 3 events before crashing, sometimes it processes, say 35 and then crashes....I suspect that I have violated some memory restriction...am I supposed to close after a plot command or something?

댓글을 달려면 로그인하십시오.


Jason Ross
Jason Ross 2011년 7월 1일
Are you running Windows Vista or Windows 7 with UAC enabled? Some of the folders might be accessible only with elevated privileges.
You can test this in one of the following three ways:
  • Start MATLAB in an elevated Administrator prompt
  • Disable UAC entirely (this will require a reboot, and administrative privileges)
  • Try and create a file of some kind in C:\Users\ilevine\AppData\Local\Temp
The solution will vary depending on what control you have over your environment. You might be able to change the MATLAB code to use a folder where you have write permission, change the machine's security configuration, change the permissions on the directory, etc.
  댓글 수: 2
Ilan levine
Ilan levine 2011년 7월 1일
Thanks Jason,
I am using WINDOWS 7. The fact that I can run through several loops before dying makes me pretty sure I am not violating privileges....The entire loop processes fine N times (where N is some number <95 ) and thus executes every command without complaints, until it suddenly dies.... :(
Jason Ross
Jason Ross 2011년 7월 5일
How much disk space is free?

댓글을 달려면 로그인하십시오.


Peter
Peter 2011년 10월 4일
I'm curious if anyone has found an answer or resolution to the problem? I'm encountering a similar issue on Windows XP with R2009a: after updating and printing a figure in a loop, the code reports an error after some (apparently) arbitrary number of loop iterations. My error is nearly identical:
Error using ==> print at 325
C:\DOCUME~1\(ADMINISTRATOR FOLDER HERE\LOCALS~\Temp\tpa4279a42_d1a8_4883_bc1b_6b2420366b56.ps:
Cannot open file: permission denied.
Error in ==> (SCRIPT NAME HERE) at (SCRIPT LINE HERE)
print((CURRENT FIGURE HERE), '-dpdf', (FILENAME HERE));
I also have set in my code 'recycle off' to avoid MATLAB sending all the temporary post-script files to the recycle bin.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by