I can't delete the file obtained with matlab
19 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
.....
writecell(bu,hhh,'Delimiter',' ');
when I kill writecell process (using ctrl+c) in matlab i receive this error and if i try to delete file
i receive this error:
The operation could not be completed because the file is open in matlab R2024a
0 Commenti
Risposta accettata
dpb
il 21 Lug 2024
Spostato: dpb
il 21 Lug 2024
You'll have to exit and restart MATLAB, then...
I've never had MATLAB keep the file handle open; Excel if using ActiveX and crash, yes, but not MATLAB.
Somehow the error handler/cleanup function isn't managing to close the open file and let the OS know. That is worthy of a bug report, but it is probably not reliably reproducible.
But, Ctrl-C while writing a file is risky behavior although ideally it should be able to be handled...
3 Commenti
dpb
il 21 Lug 2024
There is no provided facility for that; you would have to stuff the Ctrl-C into the keyboard buffer and drawnow to update callbacks (and not sure that would work). Such things should be avoided.
The only clean way to do something of that sort would be to not dispatch the writecell call with the entire file but in a loop and check for user cancellation at the end of each pass through the loop. This would obviously add even more overhead and have a latency period (MsgBox("Please Standby")) until the current call completes and can check the flag to terminate.
What and how large a file are you writing such that it is wanted to cancel the operation? If the user asked to write the file, it would seem a fairly rare event to then subsequently want to cancel?
I think it may be worth a support request to Mathworks about the open file handle from the command line to see if they think that is expected behavior or not despite the poor practice from user. I would think the registered cleanup functions should be able to deal with it cleanly, but it's worth asking about. As said, I've not seen the symptom, but I've not done the exercise that often and don't have that release of MATLAB installed.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!