how can i clear the variables except the ones i need inside a loop
185 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i need to run some scripts inside a loop in order to make a parametric study on some variables inside the scripts. At each iteration i need to change the input variables for the script, save the variables of interest in an array and clear all the others.
1 comentario
Stephen23
el 12 de Sept. de 2016
Write functions instead of scripts, then this task will be trivial.
Respuestas (1)
Saurabh Gupta
el 19 de Sept. de 2016
Editada: Saurabh Gupta
el 19 de Sept. de 2016
Hello Domenico,
You can use the clearvars command, with the -except option, to clear all the variables except the ones you need. You will have to specify the required variables by using either their names or regular expressions (with the -regexp option).
For more details and examples, refer to the attached MATLAB documentation page.
0 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!