필터 지우기
필터 지우기

Error: -16 Access Denied on xPc Target

조회 수: 1 (최근 30일)
Nathan
Nathan 2014년 8월 19일
댓글: Nathan 2014년 8월 20일
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

답변 (1개)

Rajiv Ghosh-Roy
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)
  댓글 수: 1
Nathan
Nathan 2014년 8월 20일
Rajiv, thank you for your answer, I have tried that and it produced an error. However I found that when i moved:
fsys=xpctarget.fs;
inside the loop the fclose function worked and thus the other code did as well.

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

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by