Finding Corresponding Values In Cells

Hello,
I just wanted to get an opinion on the best way to approach a problem. I am importing an excel sheet which contains numbers and strings using xlsread. From the created cell I want to find a numerical value in the first column and then print the corresponding value from the second column.
Any tips on which functions to run would be much appreciated.
Thanks, Ross

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 3월 25일

0 개 추천

v={1 'a';2 'b';'s' 'e';1 'e' ;4 'z'}
idx=cellfun(@isnumeric,v(:,1))
out=v(idx,2)

댓글 수: 1

Ross Westwood
Ross Westwood 2016년 3월 25일
Thanks, cellfun might be what I am looking for, but the @isnumeric is not quite the right function. The user will input a value. For example, if you were to imagine it was patient records in the cell, it will ask for the patient number and display the corresponding height of that person. Any idea on what will be used for this?

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

카테고리

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

질문:

2016년 3월 25일

댓글:

2016년 3월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by