MATLAB: How to get the index of a value in a table indextable 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 Best Answer index = find(TABLE{:,:}==specific_value)%or[~,index] = ismember(specific_value,TABLE{:,:})If you're dealing with decimals you need to use ismembertol(). Related SolutionsMATLAB: How to extract a range of values from a variable table You can index into a table similar to a matrix. For exampleextracted_values = myTable(:, 6:20);convert to simple matrixM = table2array(extracted_values) MATLAB: I have imported a table with 4 columns and 1000 rows. I want to find the index of a specific row of data (that exists) which I know the values of i.e. [ 74 8.5 9 8.5]. How FileData = load('Table.mat');Data = table2array(FileData.Table);Search = [74 8.5 9 8.5];index = find(sum(abs(Data - Search), 2) < 4 * eps(max(Search)))This is the secure method using a tolerance. Alternatively:[found, index] = ismembertol(Search, Data, 'ByRows', 1)In your case you have luck with the simple:[found, index] = ismember(Search, Data, 'rows')also, but do not rely on comparing floating point numbers exactly. See:any(0:0.1:1 == 0.3) % false! Related QuestionHow to compare two tableDoes “rowfun” preallocate a tableHow to find specific value in a tableRemove zeros in a table
Best Answer