필터 지우기
필터 지우기

how can i clear the variables except the ones i need inside a loop

조회 수: 185 (최근 30일)
Domenico Gabriele
Domenico Gabriele 2016년 9월 12일
편집: Saurabh Gupta 2016년 9월 19일
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개)

Saurabh Gupta
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.

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by