Azzera filtri
Azzera filtri

Error: -16 Access Denied on xPc Target

1 visualizzazione (ultimi 30 giorni)
Nathan
Nathan il 19 Ago 2014
Commentato: Nathan il 20 Ago 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

Risposte (1)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy il 20 Ago 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 Commento
Nathan
Nathan il 20 Ago 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.

Accedi per commentare.

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by