Logical Indexing returns error
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!