Effacer les filtres
Effacer les filtres

Error: -16 Access Denied on xPc Target

1 vue (au cours des 30 derniers jours)
Nathan
Nathan le 19 Août 2014
Commenté : Nathan le 20 Août 2014
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

Réponses (1)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy le 20 Août 2014
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 commentaire
Nathan
Nathan le 20 Août 2014
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by