How to create a "macro" button on Matlab editor
Mostrar comentarios más antiguos
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.
Respuestas (1)
Walter Roberson
el 2 de Oct. de 2012
0 votos
To solve the issue of closing the file, have you considered using an onCleanup() ?
1 comentario
Nilanjan
el 3 de Oct. de 2012
Editada: Walter Roberson
el 3 de Oct. de 2012
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!