How do I create a class with functional syntax, like griddedInterpolant?

2 ビュー (過去 30 日間)
Richard Crozier
Richard Crozier 2016 年 8 月 10 日
コメント済み: Richard Crozier 2016 年 8 月 10 日
The documentation for the griddedInterpolant has an example like the following:
[X1, X2] = ndgrid(1:10,1:10);
V = X1.^2 + X2.^2;
F = griddedInterpolant(X1,X2,V, 'cubic');
[X1q, X2q] = ndgrid(1:0.5:10,1:0.5:10);
Vq = F(X1q,X2q);
In the last line the object is called like it is a function. Can I create a class with this syntax, and if so, how?

採用された回答

Steven Lord
Steven Lord 2016 年 8 月 10 日
Yes. See the examples on this documentation page and this documentation page that show how to overload indexing to support this pattern.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by