How can i sort data using logical indexing?
Ältere Kommentare anzeigen
problem: i have two arrays: the first one is of unknown lenght and has two columns, one containing the data that i want to add to my second array and one containing a natural number (ranging from 1 to unknown) looking like this:
[ 0] [3]
[ 0] [5]
[ 3.36] [ 2]
[ 0.00100000000000122] [ 6]
[0.000999999999999446] [ 4]
[0.000999999999999446] [ 2]
my second array is empty. now i want to add the values (first columns) to the associated row ( second column) in my second array. There are multiple values for each row. the output of the second array should look like this:
[] []
[3.36] [0.00099999999446]
[0] []
[0.0009999999999446] []
[0] []
[0.00100000000000122] []
Is there a way to do this using logical indexing? It would be nice if i could avoid using for loops with if statements
Thanks.
2 Kommentare
the cyclist
am 7 Jan. 2016
Can you write explicitly what you want the output to be, for this example?
Timo Merker
am 7 Jan. 2016
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Type Identification 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!