看板 MATLAB 關於我們 聯絡資訊
假使 有A字串 2018-01-09,19:29:20,1,,,,,,,,,QFN48LD-6X6[14X35]-ISSC 然後要取出中括號中的字串 14X35 目前是以下做法 但其實有點繁瑣 S=strsplit(A, '[');%根據前括號分開 C=S(2);%取後半段 C=cell2mat(C); % strsplit不接受cell故轉換 D=strsplit(C, ']');%根據後括號分開 D=D(1);%取前半段 D=cell2mat(D); 則 D=14X35 如有更好作法請指教 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.124.240.138 ※ 文章網址: https://www.ptt.cc/bbs/MATLAB/M.1516004218.A.19B.html
brad0315: 試試用strfind去定位? 01/15 16:58
purpon: 用regexp 01/17 08:18