필터 지우기
필터 지우기

How can I show user defined classes?

조회 수: 3 (최근 30일)
Michael
Michael 2014년 5월 5일
댓글: Michael 2014년 5월 19일
So in Matlab clear classes is a pretty important command. But how can I show classes that I have defined, i.e. those that would be cleared by clear classes?
  댓글 수: 2
Geoff Hayes
Geoff Hayes 2014년 5월 5일
Michael - I don't think that there is a way to list all user-defined classes. You can type whos from the Command Window to get a list of all currently instantiated variables and see their class names from that.
Is your concern that clear classes will cause you to lose class information? Because all it does is clear the currently loaded definitions for all classes (or those that you specify) which means that the next time you create an instance of a user-defined class, then the latest definition of that class will be used.
For example, suppose I have a 128-bit unsigned integer class called uint128. I create several instances of the class:
x = uint128(1233);
y = unit128(3455);
z = x+y;
I observe that the addition did not work as expected (the wrong result was returned). So I make some changes to the class definition uint128.m file. But those changes don't come into affect until I do a clear all or clear classes because it the old class definition is still being used. So I just type clear classes and then repeat the above example to see if the addition finally worked.
Michael
Michael 2014년 5월 19일
No, I was just trying to understand the structure of Matlab better and how I can access information that seems non-transparent (IE current user defined classes in the environment)

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

답변 (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