Remove elements within a range from an array
Mostrar comentarios más antiguos
Hi,
I have an array called A, which could have the example values shown below:
A = [1 1.2 3 3.1;
1 1.3 3 3.2;
2 2.1 4 4.1;]
Now, I want to be able to remove the columns that are near-duplicates (in this case within a 0.5 range of another column) and I am having trouble doing so.
For clarity:
I want the final array to just be:
A = [1 3;
1 3;
2 4]
Any help would be greatly appreciated. ALSO: it does not matter which duplicate gets removed, as long as in the end there is only 1 column that represents the numbers within that range (so the 1 1 2 column could be removed instead of the 1.2 1.3 2.1 column). NOTE: the real array I would be operating on is variable in size so I need a solution that will work for any size array.
Thanks for the help I really appreciate it!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!