1
是否有可能在MATLAB中定義類方法類似於「調用」方法?「__call__」在Matlab中相當於classdef
您將如何在MATLAB中實現以下Python類。
class Basic(object):
def __init__(self, basic):
self.basic = basic
def __call__(self, x, y):
return (numpy.sin(y) *numpy.cos(x))
def _calc(self, y, z):
x = numpy.linspace(0, numpy.pi/2, 90)
basic = self(x, y)
return x[tuple(basic< b).index(False)]