Reputation:
I'm taking in two arrays and comparing them. However, one array might be larger than the other.
So, how can I trim the larger array to the size of the smaller one to prevent a dimension mismatch?
Now, I'm using this code to trim the rows:
[nRows1, nCols1] = size(data1);
[nRows2, nCols2] = size(data2);
data1(nRows1 + 1:nRows2, :) = [];
But, this is still not working and it says that there is a dimension mismatch.
Upvotes: 0
Views: 236
Reputation: 15359
This should do it:
data1(size(data2, 1)+1:end, :) = [];
data2(size(data1, 1)+1:end, :) = [];
Upvotes: 2