Reference implementation of built-in subsref, subsasgn and subsindex

7 ビュー (過去 30 日間)
Beni Falk
Beni Falk 2011 年 4 月 27 日
回答済み: Jacob Mathew 2024 年 11 月 21 日 8:38
I have been trying to understand the intricacies of MATLAB's built-in subscripting. Documentation and the web help by providing many examples (some of them quite obscure), however I haven't been able to find a formal definition of the subscripting rules such that I would understand, once and for all, what is allowed and what is not (and hopefully why).
A second best option would be having access to a reference implementation of the builtin subsref, subasgn and subsindex functions. Then I could trace the interesting cases and deduce the rules.
I understand fully that such code would be awfully inefficient compared to MATLAB's built-ins, however it would be an invaluable learning tool.
Has anybody encountered a reasonably complete reference implementation of the built-in subsref, subsasgn and subsindex functions (preferably from MathWorks)?
Thanks,
Beni

回答 (1 件)

Jacob Mathew
Jacob Mathew 2024 年 11 月 21 日 8:38
Hey Beni,
You can reference the following documentation to help uderstand some code patterns for subsref and subsasgn:
The complete documentation to customize object indexing can be found below:

カテゴリ

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