Deleting sepecific character from cell array

조회 수: 11 (최근 30일)
Shilo
Shilo 2013년 1월 15일
댓글: Muhammad Usman Saleem 2017년 11월 5일
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일
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일
% 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
José-Luis
José-Luis 2013년 1월 16일
Please don't forget to accept an answer if it helps you.
Muhammad Usman Saleem
Muhammad Usman Saleem 2017년 11월 5일
This answer is for cell array of {1,5} what about array of {31,6} ?

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by