Search data clusters and saving them.
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello there, i have a problem with writing a script.
The goal of the specific part of script that troubles me is to find values in a certain range inside a matix (so far so easy) and to save them in a new matrix. I calculated angels between 2 vectors: the script calculates the angel between V1 & V1 then V1&V2 then V1&V3... so on , in the next step V2&V2 ... so every vektor with every following, I saved all that data in a Matrix so 1st row is V1& every following, 2. row V2& every following.
Now i want to find clusters. Lets say every value above 0 and not more then equal to 10 is part of a cluster. I want the script not ony going trough every row, i want it to check if the rows are intertwined with each other so if there is a value at the point (1,2) that is 6 i want to save every value of the second row that meets the conditions in the same matrix as the values of the first row.
My Attemt looks like this:
[irow,icol,ind] = find(anr>0 & anr<=10);
irc = [irow,icol];
for i = 1: length(ind)
for is = 2: length(ind);
k(i) = find(irow(i) == irow(is));
[cro(i)] = icol(is) == irow(i);
end
end
As you can imagin it is not working , i am glad for every Tip and help i can get (i am very stuck with this). If there is a better way to do this i will gladly listen.
Kind Regards Jonas
0 Commenti
Risposte (1)
Mahesh Taparia
il 9 Gen 2020
Hi,
You can directly do by the following lines of code:
X=(anr>0 & anr<=10);
Y=anr.*X;
Y will contain the required data.
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!