Deleting sepecific character from cell array

Hi Helpers,
I have a cell array in which some cell has " that I would like to delete such as, '"22000' or '"contig_2012'. (I want it as '22000' or 'contig_2012')
Will be great if you could help me to delete all of them from the cell.
Thanks, Shilo

 채택된 답변

Daniel Shub
Daniel Shub 2013년 1월 16일

0 개 추천

This sounds like a job for a regular expression (albeit a simple one)
x = {'"22000'; '"contig_2012'; 'abc'};
regexprep(x, '"', '')

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 1월 15일
편집: Azzi Abdelmalek 2013년 1월 15일

3 개 추천

% in this example we rmove '00' and '123'
A={'123' '1234' '12345' '11' '00'};
idx=cellfun(@(x) isequal(x,'00') | isequal(x,'123'),A);
A(idx)=[]

댓글 수: 3

Shilo
Shilo 2013년 1월 16일
Thanks a lot , will try this
José-Luis
José-Luis 2013년 1월 16일
Please don't forget to accept an answer if it helps you.
This answer is for cell array of {1,5} what about array of {31,6} ?

댓글을 달려면 로그인하십시오.

카테고리

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

태그

질문:

2013년 1월 15일

댓글:

2017년 11월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by