Problem with indexing in structures
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dionisio Mendoza
am 6 Sep. 2021
Kommentiert: Dionisio Mendoza
am 8 Sep. 2021
Hi there!
I am practicing the index on structures. I am trying to find a specific column of a structure using "strcmp".
In the following lines of code I load the file, I make a variable of the headers and in the Genesnumber variable I save the data of the Gene Symbol column belonging to myData
myData=importdata('xd.xlsx','\t')
headers=myData.textdata(1,:);
Genesnumber=myData.textdata(:,strcmp('Gene Symbol',headers));
Now I am trying to do the same (extract the data from a specific column) but with the HAGRID header. This HAGRID column in the original file is in column number 2 exactly like the header variable.
So when I test this code the new variable is either empty or with NaN values. That means the column is moving, but I don't know how to fix that little problem.
a=myData.textdata(:,strcmp('HAGRID',headers));
a=myData.data(:,strcmp('HAGRID',headers)); %here change textdata for data
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures 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!