Error: -16 Access Denied on xPc Target
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to create a file to run a batch of tests saving the resulting .DAT file from the File Scope each time. What I have found is that the .DAT file is created on the first run but subsequent runs aren't able to access it to overwrite the data involved meaning i get the data from the original test saved multiple times. Have included my code below, I believe the problem lies with the SIHS.dat file being opened but not closed.
widths=[0.1 0.3 0.5 0.7];
frequencys=[10 50 200 30];
rtwbuild('SIHSBatch');
fsys=xpctarget.fs;
for n=1:4
num=num2str(n);
exp=strcat('Qloss',num);
setparam(tg,0,widths(n));
setparam(tg,1,frequencys(n));
tg.start
while strcmp(tg.Status,'running')
pause(0.05)
end
h=fsys.fopen('SIHS.DAT');
data=fsys.fread(h);
fclose('all');
eval([exp '=readxpcfile(data)']);
filename=strcat('Qloss',num2str(n),'.mat');
save(filename,exp);
end
댓글 수: 0
답변 (1개)
Rajiv Ghosh-Roy
2014년 8월 20일
You are correct in guessing that the file is not closed properly. You need to change the fclose call in
h=fsys.fopen('SIHS.DAT');
data=fsys.fread(h);
fclose('all');
to
fsys.fclose(h)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!