MATLAB 帮助中心
将 MATLAB 字符串数组转换为 Python NumPy 字符串数组
自 R2026a 起
npa = pystringarray(mla)
npa = pystringarray(mla) 将指定的 MATLAB® 字符串数组转换为 NumPy StringDType 数组。此函数需要 NumPy 2.0 或更高版本。
npa
mla
StringDType
示例
全部折叠
将 MATLAB 字符串数组 mla 转换为 NumPy StringDType 数组 npa。
mla = ["sandwich" "salad" missing; "samosa" "soup" "sushi"]
mla = 2×3 string array "sandwich" "salad" "<missing>" "samosa" "soup" "sushi"
npa = Python ndarray: [['sandwich' 'salad' None] ['samosa' 'soup' 'sushi']] Use details function to view the properties of the Python object. Use string function to convert to a MATLAB array.
输入数组,指定为任意大小的字符串数组。
输出数组,以 NumPy StringDType 数组形式返回。npa 的维度与 mla 的维度相同。
在 R2026a 中推出
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处