필터 지우기
필터 지우기

find a particular string from struct cell array

조회 수: 3 (최근 30일)
upol
upol 2019년 1월 10일
편집: Adam Danz 2019년 1월 10일
I have something like this,
aircraft(1).field="B747#1CM001"
I need to isolate "B747" and "1CM001" from this string. So I need to find # sign from the string.
s1=aircraft(1).field
s2="#"
I use index=find(strcmpi(s1,s2))
This doesnt work
The code has to be compatible to Matlab Coder

답변 (1개)

Adam Danz
Adam Danz 2019년 1월 10일
편집: Adam Danz 2019년 1월 10일
Try this
idx = strfind(s1,s2);
part1 = s1(1:idx-1);
part2 = s2(idx+1:end);

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by