How to remove double quotes from a field?

조회 수: 3 (최근 30일)
Bhushan Dhamale
Bhushan Dhamale 2018년 5월 23일
댓글: Bhushan Dhamale 2018년 5월 23일
I have a structure dataMtb which contains a field genes. The field is a cell array having dimension of 4109*1 and contains double-quoted alphanumeric content in each cell. I need to remove the quotes from all the cells. (e.g. "Rv001c" ---> Rv001c). I am attaching the structure file for reference.

채택된 답변

KSSV
KSSV 2018년 5월 23일
S = load('dataMtb.mat') ;
str = S.dataMtb ;
str.gene = cellfun(@char,str.gene,'un',0) ;

추가 답변 (1개)

Fangjun Jiang
Fangjun Jiang 2018년 5월 23일
The double quotes indicate the data is cell array of "string" class, not cell array of "char" class. They are not part of the data value itself.
Not sure what is your real need to "remove" the double quotes, you might want to re-consider whether you want to convert the class of the data.
  댓글 수: 1
Bhushan Dhamale
Bhushan Dhamale 2018년 5월 23일
Thank you for the information Fangjun. I am new to MATLAB so I don't know much about it. I actually need to convert it to match it with another cell array of char class.

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

카테고리

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

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by