Logical Indexing returns error
Show older comments
Hi,
I'm trying to extract a two column vector from another two column vector using a logical statement.
For example, if column one contains x values and column two the corresponding y values, I want to create another matrix that contains only the x and y values when x is equal to a particular number. Here's the code I've used:
extracted_data=initial_data(initial_data==0,:);
This seems to work for some small test matrices. However, when I try to scale it up to extracting data from a vector with 64516 rows, I get the following error:
??? Index exceeds matrix dimensions.
Any ideas how I can avoid this? I've achieved the result I want using a loop and "if" statements, but this is SLOW!
Many thanks in advance,
T
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!