indexing a set in an array
Ältere Kommentare anzeigen
Dear users, Im trying to find a fast way to index a set of elements of an array that meet some criteria. For instance, Imagine that I have an array A=zeros(Nx,Ny) Nx=1000;Ny=1000. so A(k,l)=0 for all k,l<1000. Now I would like the set of indices, call them SET, that fullfill (k-ko)^2+(l-lo)^2<R^2 From which I can A(SET)=1. In this way with any given distance function I can build indicator functions for arbitrary sets.
4 Kommentare
Adam Danz
am 18 Jan. 2021
If you show us what you've tried so far we can see if we can beat it.
Paul Gendron
am 21 Jan. 2021
Bearbeitet: Paul Gendron
am 21 Jan. 2021
Adam Danz
am 22 Jan. 2021
Looks like Matt J hit the nail on the head. ✅
Paul Gendron
am 22 Jan. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Performance and Memory 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!