How to create a "macro" button on Matlab editor
Mostra commenti meno recenti
The short version of my request is:
Is there a way to have a macro that combines two commands, 1. fclose all 2. exit debug mode(shift+F5)
and make it available on the editor as a button, just like there are buttons for "exit debug mode (shift+F5)", "Continue (F5)" etc.
Here is the long version:
I use Matlab to digest a datafile and display certain outputs as images. I open the datafile (txt) outside a for loop, read a bunch of lines from it at every iteration, and display certain computed outputs in a image. I close the file (using fclose) only after the for loop is over.
Most of the time, I only run a few iterations of the for loop and then press exit (Shift+F5) to stop the run. But this does not execute the "fclose(fid)" command at the end of the file. Hence, the original output file is still being "used" by Matlab as far as other programs are concerned. In order to release the file, every time I have to type "fclose all" in the command window, which is annoying. I am wondering whether I can combine "fclose all, followed by exit (shift+F5)" commands and create a macro that I access on my editor window.
Risposte (1)
Walter Roberson
il 2 Ott 2012
0 voti
To solve the issue of closing the file, have you considered using an onCleanup() ?
1 Commento
Nilanjan
il 3 Ott 2012
Modificato: Walter Roberson
il 3 Ott 2012
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!