isprop for custom classes

3 ビュー (過去 30 日間)
Dmitry Borovoy
Dmitry Borovoy 2011 年 9 月 12 日
Why isprop doesn't work for custom classes in Matlab versions earlier than 2011a? Even help shows that this feature works only for COM object. So how to check is property a property of my class? sorry for my english...

採用された回答

Daniel Shub
Daniel Shub 2011 年 9 月 14 日
I don't know why TMW only implemented isprop for custom classes in r2011a, but it is pretty easy to work around. To test if a string y is a property of an object obj:
x = metaclass(obj)
tf = ismember(y, {x.PropertyList.Name});
This doesn't do any error checking on obj or y. If you have r2011a you can see the copyrighted source code of TMW's implementation of isprop.
edit isprop
  1 件のコメント
Dmitry Borovoy
Dmitry Borovoy 2011 年 9 月 25 日
sorry, was offline

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCustomize Object Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by