Hi, I am quite new to matlab and i am in need of some help.
Lets say I have a matrix: [2 2 2 3 3 3 3 3 3 3 5; 6 6 7 2 2 2 2 2 2 2 6; 2 1 3 1 2 3 2 4 1 6 1]
My goal is to shrink the matrix to: [2 2 3 5; 6 7 2 6; 2 3 6 1]
I am looking for a code where I want to keep the maximum values for row three, where row1 and row2 have the same values.
My code should look something like this:
for count:1:endif matrix(1,count)==matrix(1,count-1) && matrix(1,count)==matrix(1,count-1) && matrix(3,count-1)<matrix(3,count)then remove previous column.
Code isn't finished, but this was just to give an rough idea.
The problem is that the for loop doesn't seem to work when i remove a column (because the column counter continues counting), and also when it removes the previous column there is no reference to compare to anymore.
The matrix above is an example, I thought about a for-loop, because the actual matrix has over 20000 columns.
Could somebody give me a some help me with the code?
Thanks in advance, Paul
Best Answer