compare index 1 to index s within loop. index exceed matrix dim
Show older comments
I have 12 files (M) each with 12 columns to which I want to compare each file columns to another file columns.
for s =1:numel(M)
if all(strcmpi(M(1),M(s))) == 1
M = M(s);
end
end
However, I am getting index exceed matrix dimension. Any help as to how to improve this loop would be nice.
4 Comments
Azzi Abdelmalek
on 11 Nov 2013
12 files or 12 matrices?
Leyon
on 12 Nov 2013
Walter Roberson
on 12 Nov 2013
Perhaps you want any() instead of all() ?
Leyon
on 12 Nov 2013
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!