unnecesary variables are not shown after running the programm.

조회 수: 1 (최근 30일)
som
som 2011년 9월 9일
Hi all I have written a program in matlab whih has a lot of variables and parameters.when I run the program, the workspace is full of unnecessary variables. how can I write the mentioned program in the way that unnecesary variables are not shown in workspace after running it?
thanks in advanse,

채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 9일
Write function instead of script. For example
function [a b c] = my_function
q = 1;
s = 2;
e = 3;
r = 5;
a = q+s;
b = e - r;
c = rand(1);
And run it in this way:
[a b c] = my_function
Or you can use clearvars (clear) function. For example:
q = 1;
s = 2;
e = 3;
r = 5;
a = q+s;
b = e - r;
c = rand(1);
clearvars s e r q
  댓글 수: 2
som
som 2011년 9월 9일
thanks alot
Grzegorz Knor
Grzegorz Knor 2011년 9월 9일
Another, similar way:
clearvars -except a b c

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by