从 python 开始到八度
startswith from python to octave
我有一个 python 代码,想用 Octave 编写一个相同的代码,但是有些命令我从未在 Octave 中找到它们。我不明白的代码的一部分是这个函数:
def CVangles(theta, geo, key):
"""
Parameters
----------
theta : float
The crank angle, between 0 and 2*pi
geo : struct
The structure with the geometry obtained from get_geo()
key : string
The name of the involute to be considered
"""
CV = struct()
CV.Outer = struct()
CV.Inner = struct()
if key.startswith('c1.'):
alpha = int(key.split('.')[1])
CV.Outer.involute = INVOLUTE_FI
CV.Outer.phi_0 = geo.phi_fi0
return CV
如何在startswith和split中用Octave表达
我有一个 python 代码,想用 Octave 编写一个相同的代码,但是有些命令我从未在 Octave 中找到它们。我不明白的代码的一部分是这个函数:
def CVangles(theta, geo, key):
"""
Parameters
----------
theta : float
The crank angle, between 0 and 2*pi
geo : struct
The structure with the geometry obtained from get_geo()
key : string
The name of the involute to be considered
"""
CV = struct()
CV.Outer = struct()
CV.Inner = struct()
if key.startswith('c1.'):
alpha = int(key.split('.')[1])
CV.Outer.involute = INVOLUTE_FI
CV.Outer.phi_0 = geo.phi_fi0
return CV
如何在startswith和split中用Octave表达