Search for a value in a table and get the corresponding value from the 2nd column
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Max1234
am 2 Apr. 2023
Kommentiert: Star Strider
am 20 Jan. 2024
Hi guys,
I have a table of values and would like to search for a value and then get the corresponding value from the 2nd column. Can anyone help me with this problem?
Thanks a lot!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 2 Apr. 2023
If you are searching for an exact match, try something like this —
Col1 = linspace(0, 10, 21).';
Col2 = randn(numel(Col1),1);
T1 = table(Col1,Col2)
Val = 3;
Result = T1{Col1==Val,:}
Much depends on the table and what you want to do. This is simply an illustration of the most obvious approach.
.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cell Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!