difference between 'clear' and 'clear all' ?

59 ビュー (過去 30 日間)
Sagar
Sagar 2016 年 3 月 8 日
回答済み: Jan 2016 年 3 月 8 日
any advantage with clear. (anything apart from the details given in Documentation).
  1 件のコメント
Stephen23
Stephen23 2016 年 3 月 8 日
編集済み: Stephen23 2016 年 3 月 8 日
"any advantage"
It depends what you mean by "advantage": when do you wish to use this command? What do you want it to do?
Many beginners write scripts that create lots of variables. Then the beginners want to get rid of their variables and so they write clear at the beginning of every script. The proper solution to this is not to use clear, but to write functions. It really is that simple! Advanced MATLAB users tend to write functions, not scripts.
Ditto for close and clc. These can also be avoided by reusing figures by keeping track of their handles, and not printing screeds of unreadable data to the command window.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2016 年 3 月 8 日
The details given in the documentation are exhaustive.
In former Matlab versions clear all removed the breakpoints of the debugger. But fortunately this does not happen in R2015b anymore. Impeding the debugger is a bad idea.
After a clear all the functions are removed from the RAM and the reloading from disk wastes time.

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by