MATLAB Answers

EM
0

How to get the index of a value in a table?

Asked by EM
on 22 Sep 2019
Latest activity Commented on by madhan ravi
on 22 Sep 2019
Hi everyone,
I'm new into Matlab.
I have a table T with let's say 2000 raws in one column. Values in the table are not similar.
I want to get the index of an especific value. How can I do that?
Thank you

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by madhan ravi
on 22 Sep 2019
Edited by madhan ravi
on 22 Sep 2019
 Accepted Answer

index = find(TABLE{:,:}==specific_value)
%or
[~,index] = ismember(specific_value,TABLE{:,:})
If you're dealing with decimals you need to use ismembertol().

  2 Comments

EM
on 22 Sep 2019
Thank you for your answer. Can the "specific_value" be a matrix of 1x1?
Yes a scalar.

Sign in to comment.