What does it mean when the first character on a directory containing related *.m files is @?
I am an ML Noob. I have acquired some ML code and I am attempting understand it. In it there are certain directories for which the first character of the name is @.
example: @DBserver - DBserver
- ls
- put
If I attempt to open DBserver, it opens. If I attempt to open ls or put, DBserver opens. What is going on here? I'll bet the @ means something.
I couldn't find anything on this in the documentation. Feel free to point me to it if I've missed.
Thanks in advance.

回答 (2 件)

James Tursa
James Tursa 2014 年 6 月 20 日
編集済み: James Tursa 2014 年 6 月 20 日

3 投票

@dirname means that it is an old-style class definition, the class name being dirname. All of the functions (methods) that the class supports are listed as files in that directory. To use such a class, simply put the directory that @dirname is in on the MATLAB path (i.e., do NOT put the @dirname itself on the path ... put its parent on the path). Note that this is not the same thing as a classdef type of class (the NEW style of defining classes in MATLAB).

2 件のコメント

Geoffry Roberts
Geoffry Roberts 2014 年 6 月 21 日
Ahh, we are talking classes and not just functions. I'll read up on classes. You say old-style, perhaps that's why I couldn't find much on it. The code in question is new but it was written by some long seasoned ML guys who are not available.
James Tursa
James Tursa 2014 年 6 月 25 日
The new classdef style definitely has added OOP capability compared to the @dirname class style, but only for strict m-file usage. The new classdef classes are horrible to work with in mex routines, since there are no official API functions available to get pointers to the properties. In a mex routine, the only functions available for classdef property access do a deep data copy to get or put a property. So if you are working with very large arrays it can be a deal breaker. But with the old style classes you can get and set fields easily in a mex routine without making deep copies. This can be a huge advantage if you are working with large arrays.

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

per isakson
per isakson 2014 年 7 月 3 日
編集済み: per isakson 2014 年 7 月 3 日

0 投票

@ClassName folders may be used with the new-style class definitions much in the same way as with the old-style. See
Distributing the Class Definition to Multiple Files in the page, Class Files
If you use multiple files to define a class, put all the class-
definition files (the file containing the classdef and all class
method files) in a single @ClassName folder. That @-folder must be
inside a folder that is on the MATLAB path. You can define only one
class in an @-folder.

カテゴリ

ヘルプ センター および File Exchange で File Operations についてさらに検索

製品

タグ

質問済み:

2014 年 6 月 20 日

編集済み:

2014 年 7 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by