How to make functions outside of Class folder hidden from access

4 views (last 30 days)
Hi all, I have a class folder, we'll call class1.
class1 contains properties and methods, both hidden and not.
To access these methods or properties, I use the dot notation :
class1.func1
class.Property1
I like using the 'Tab' button to cycle/auto-type through my properties and methods. However, some functions that are inherit / default to matlab are showing up
for reasons I'm not sure why. Example:
class1.AddListener
class1.delete
class1.findobj
class1.isvalid
% etc...
Most of their paths come from: C:\Program Files\MATLAB\R2018a\toolbox\matlab\lang\
they're a bit distracting, because I want the user to type:
'class1.' , hit tab, and see what they have available to access.

Accepted Answer

Steven Lord
Steven Lord on 8 Mar 2019
Your class is a handle class. As stated in the "Handle Class Methods" section of this documentation page that means you inherit a dozen methods.
For all those methods except isvalid you could "extend" it as shown on this documentation page in a methods block with the Hidden attribute and I believe that would allow them to still work while removing them from tab completion. The isvalid method is different, it is Sealed so you can't override it with a Hidden method in your subclass.
Another possibility, if your class doesn't need to be a handle class, would be to remove that superclass from your class's definition.
  1 Comment
Kevin Phung
Kevin Phung on 9 Mar 2019
Thanks for the response steven, I wasnt too sure how to formulate my search but you definitely lead me in the right direction!

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!