@ folders - what is it?

Hi,
I am looking for information about the @ - directories, I've found only: http://www.mathworks.com/help/techdoc/matlab_oop/brfynrp- 1.html#brfynrp-2
So I have question:
Why do you need these folders?
Only for organizing classes?
Or is there any other application?

 Réponse acceptée

Titus Edelhofer
Titus Edelhofer le 9 Sep 2011

0 votes

The second question is the answer: yes, it's "only" for organizing classes.
You can either use only one file or several files (each one method) in a class folder (@classname). Or a mixture. Take a look at
web([docroot '/techdoc/matlab_oop/brqy4ox-1.html'])
Titus

2 commentaires

Grzegorz Knor
Grzegorz Knor le 9 Sep 2011
Thanks.
I couldn't understand the 'strange' behavior of Matlab :)
pwd
% ../@test
ls
% not_test.m test.m
type test
% function test
% disp(mfilename)
% not_test
type not_test
% function not_test
% display(mfilename)
test
% ??? Undefined function or variable 'test'.
not_test
% ??? Undefined function or variable 'not_test'.
cd ..
test
% test
% ??? Undefined function or variable 'not_test'.
% Error in ==> test.test at 3
% not_test
not_test
% ??? Undefined function or variable 'not_test'.
Jan
Jan le 9 Sep 2011
@Titus: I do not agree. E.g. @cell folders are helpful to apply a specific function for CELL input. I would not call this "organizing classes", but on the other hand, a CELL is a built-in class also.

Connectez-vous pour commenter.

Plus de réponses (1)

Jan
Jan le 9 Sep 2011

1 vote

The @-folders can be used to call a specific function depending on the class of the input. E.g. you can create two functions with the same name, but in different @-folders:
D:\MFiles\@double\show.m
D:\MFiles\@cell\show.m
Now show(8) calls @double/show, while show({8}) calls @cell/show. This is equivalent to the usage with objects.
Note, that only 'D:\MFiles' is included in the MATLAB path in this case, and not the @-folders.

Catégories

En savoir plus sur Performance and Memory dans Centre d'aide et File Exchange

Produits

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by