필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

accessing specific records of a given dataset

조회 수: 1 (최근 30일)
Sebastiano delre
Sebastiano delre 2014년 1월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello! I have the following 5x4 dataset, called DB:
val =
line title replyno author
1 'Avensis' 1 'lui'
1 'Avensis' 2 'tu'
2 'Costs' 1 'pasquale'
2 'Costs' 2 'io'
2 'Costs' 3 'pasquale'
I want to access only records whose author is 'pasquale'. How can I do? I use new_DB = DB(DB.author=='pasquale'), but it does not work, it tells me "Undefined function 'eq' for input arguments of type 'cell'".
Thank you!
  댓글 수: 1
Sebastiano delre
Sebastiano delre 2014년 1월 15일
I got it, I had to make the variable author nominal first: DB.author=nominal(DB.author). Then it works. Thanks anyway!

답변 (1개)

Image Analyst
Image Analyst 2014년 1월 15일
Try strcmpi(), strfind(), or ismember(). Try char() if you need to convert a cell into a character string. Disclaimer: I don't work with dataset class of variables.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by