how can i clear the variables except the ones i need inside a loop
148 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Saurabh Gupta
2016-9-19
编辑:Saurabh Gupta
2016-9-19
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!