matlab - fast access of an element in struct array based on multple criteria -


i asked this question last time. answers there helpful. want suggest slight variant. need access element of struct array has a(i).x==5.65 && a(i).y==32.23?

again can run old for loop , find index of required element have make such queries multiple time. fastest data structure this? method should use search through struct array find desired element?

you can use dot indexing yield comma-separated list , coerce array. can perform logical operations on resulting array yield logical array can use index struct array

b = a([a.x] == 5 & [a.y] == 32) 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -