extracting index number if an item exist in some columns while not in the rest columns
Ältere Kommentare anzeigen
Hi,
let us say, i have a data table which has following form:
Index name A1 A2 A3,,,,,A10
and there is an item called David. The interesting things is David is in some of the columns (david is not A1, A2 columns and is in the rest of the columns).
I am interesed in the extracting the index number of david whether is in column or not (if not in the column, may return o or NaN), i tried hard, but could not write the corresponding code, can some one help?
Thanks.
4 Kommentare
Walter Roberson
am 27 Mär. 2020
Can the item ever appear multiple times in the same column? If so do you want the first index, the last index, or all of the indices?
Is this a table() object? Are the entries character vectors?
Akira Agata
am 27 Mär. 2020
You mean, you have something like the following table
T =
4×6 table
A1 A2 A3 A4 A5 A6
__________ __________ __________ __________ __________ __________
{'David' } {'Bowie' } {0×0 char} {0×0 char} {0×0 char} {0×0 char}
{0×0 char} {0×0 char} {0×0 char} {0×0 char} {'David' } {0×0 char}
{0×0 char} {0×0 char} {'David' } {0×0 char} {0×0 char} {'Bowie' }
{0×0 char} {0×0 char} {0×0 char} {'Bowie' } {0×0 char} {0×0 char}
...and want to find the column which contains 'David' ( A1, A3, and A5 in the above example) ?
mirewuti muhetaer
am 27 Mär. 2020
mirewuti muhetaer
am 27 Mär. 2020
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!