How do I create a class with functional syntax, like griddedInterpolant?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Richard Crozier
am 10 Aug. 2016
Kommentiert: Richard Crozier
am 10 Aug. 2016
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?
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 10 Aug. 2016
Yes. See the examples on this documentation page and this documentation page that show how to overload indexing to support this pattern.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!