String Manipulation Syntax

I have a cell array. Column 1 contains a string, and I would like to extract characters 4 through 8 of this column (in each row) and place this in column 10. I understand how to do make column 10 match column 1 with:
fdata(:,10) = fdata(:,1);
but how to I make fdata(:,10) just contain characters 4 through 8 of fdata(:,1)?
Thanks for the the help.

 채택된 답변

Oleg Komarov
Oleg Komarov 2012년 1월 9일

0 개 추천

fdata(:,1) = cellfun(@(x) x(4:8),fdata(:,1),'un',0)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by