Select a specific row for a cell array according to it's class

Hello everyone, i have a cell array like this: 15000 - class1 13890 - class2 15990 - class 3 187774 class3 124699 class2 78909 class1. I want to extract the first class1 row ,only the first!! How can i do this??

 채택된 답변

Image Analyst
Image Analyst 2014년 12월 13일
Where is the class stored, and is it a string like "class1" or a number like 1? What does this show when you run it
whos yourCellArray
celldisp(yourCellArray)
Have you tried using ismember() to locate what rows in your cell array match a certain string like 'class3'?

댓글 수: 2

My class is a string like 'run'. Also i have another problem. I read a txt file with textscan and then when i try to access my cell array the results shown as {1x1 cell array} and not the 'run'. I try also strcmp but it didn't work as it can not access the cell array
Alex,
it sounds like you are happy that Image Analyst's answer solved your problem since you've accepted it. It's not clear from your comment though.
As for your new question, you're better off starting a new one. Not many people read questions in comments, particularly if a question has been marked as answered.
When you ask your new question, do make it clearer by giving an example of inputs and expected outputs, as as asked I've no idea what the problem is.

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

추가 답변 (0개)

카테고리

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

질문:

2014년 12월 13일

댓글:

2014년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by