Using intersect to assign a classification
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there!
I've created a classification matrix and have used intersect to find the common cell, but the problem is that I want the information in the cell next to it.
Example:
US-Goo US-Ha1 US-Ha2
GRA DBF ENF
What I have:
a=length(landclass)
IGBPclass=intersect(sitename, landclass)
IGBPclass='US-Ha1'
Ideally I want IGBPclass to be the second 3 letter classification.
Thanks!
2 Kommentare
Akzeptierte Antwort
Matt J
am 5 Jun. 2013
Bearbeitet: Matt J
am 5 Jun. 2013
The third line is the output of the intersect function.
That's very confusing since we cannot distinguish it from other lines of code. This is how you should show contents of variables to the public,
>> landclass, sitename
landclass =
'US-Goo' 'US-Ha1' 'US-Ha2'
'GRA' 'DBF' 'ENF'
sitename =
US-Ha1
If the above is the form your data is in, I suspect you are trying to do this:
>> logicalIndex=ismember(landclass(1,:),sitename);
>> IGBPclass=landclass{2,logicalIndex}
IGBPclass =
DBF
Weitere Antworten (1)
the cyclist
am 5 Jun. 2013
I don't fully understand what you are trying to do. However, if you read
doc intersect
you will see that you can call that command with more than one output. The second and third outputs are the indices for the elements that are in the intersection of the two sets. Maybe you can use those indices to do what you want.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Classification 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!