【发布时间】:2013-03-14 20:44:03
【问题描述】:
我有一个字符串元胞数组。我需要为每个项目提取 1 到 n 个字符。字符串总是长于 n 个字符。请看:
data = { 'msft05/01/2010' ;
'ap01/01/2013' }
% For each string, last 10 characters are removed and put it in the next column
answer = { 'msft' '05/01/2010' ;
'ap' '01/01/2013' }
是否有可能的矢量化解决方案?我曾尝试使用 cellfun,但没有成功。谢谢。
【问题讨论】:
标签: string matlab character cell