find similar element in a matrix
Ältere Kommentare anzeigen
I have several questions. First, I have several vectors with different dimensions. I want to put them all in one matrix. I would fill it with zero to make them the same size as follows.
Do you know how to do it?
X= [1 2 3 9 20 67 81 43 101 24;
43 42 88 20 43 67 101 0 0 0;
22 44 0 0 0 0 0 0 0 0;
10 20 67 43 101 0 0 0 0 0;
]
I have a matrix, I want to generate a vector of all elements that are similar in all raws of that matrix. Some raws might have nothing similar as other raws. I count those element similar as if they are similar (e.g. 22 is similar to 22) or they are + - 2 different (e.g. 22 is similar to 24 or 20) the dimension of each raw is different. for example The similarity should be at least between three raws that we select that element.
Then I want to get a vector of all similar elements in all raws as follows
Y=[20 43 67];
Akzeptierte Antwort
Weitere Antworten (1)
Jos (10584)
am 2 Mai 2014
0 Stimmen
As for your first question, take a look at my PADCAT function on the File Exchange as it does exactly what you want. http://www.mathworks.com/matlabcentral/fileexchange/22909-padcat
As for your second question, if you consider 22 to be the same as 20 and 24, are 20 and 24 then also the same?
3 Kommentare
Niki
am 2 Mai 2014
Jos (10584)
am 3 Mai 2014
So, 1 is the same as 3 which is the same as 4 which is … the same as … is the same as 123456789… !
Are you looking for some kind of cluster analysis? I think you need to be more precise in your goal.
Sara
am 3 Mai 2014
I think you take one element per time from a row and look if there are elements within +-2 in all the other lines. Then you start over with a new element.
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!