My goal is to make my values in my matrix unique.
Here is a image of my end product

I have tried debugging this but cant seem to understand what is going wrong
So there will only be one [17;4] one [17;7] and so on
My goal is to make my values in my matrix unique.
Here is a image of my end product

I have tried debugging this but cant seem to understand what is going wrong
So there will only be one [17;4] one [17;7] and so on
You can use unique with the 'rows' input. In this case you want unique columns, so you have to transpose the input and output using .'.
M = [7 7 7 7 8 8;
4 4 4 7 9 9]; % dummy data
M = unique( M.', 'rows', 'stable' ).'; % unique columns, without sorting
% Out: [7 7 8
% 4 7 9]
You need the 'stable' input to avoid sorting numerically, you can omit it if you don't care about that.