[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Deleting rows in matrices
From: |
Qualitang |
Subject: |
Deleting rows in matrices |
Date: |
Tue, 13 Sep 2011 18:09:17 +0800 |
Hi,
I am having (another!) problem on a seemingly innocuous task. Say I
have many (le x 1) matrices, A, B, C, ......, all of the same length
"le". I want to check each of the elements in "A", and if an element
exceeds a limit I want to delete that row, plus the corresponding rows
in B, C, ...., . Here's my try..
le = length(A)
for i = 1:le
if (A(i,1) > 5)
A(i,:) = [];
B(i,:) = [];
C(i,:) = [];
.....
endif
endfor
But I keep getting errors that say the index exceeds the matrix
dimension - I understand why, it's obvious, but I can't think of
another method to do this!
Any help is appreciated.
Matt.
- Deleting rows in matrices,
Qualitang <=