Making different combinations from tree branches in matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sohaib Bin Altaf
le 16 Mai 2018
Réponse apportée : Sohaib Bin Altaf
le 5 Juil 2018
Hello, I have to make all possible combinations from a tree, starting from parent node and ends at the last leaf nodes. I made a code for a fix number of tree branches (4 APs candidate locations),and it worked well for me but i need to make it dynamic so it works for different number of APs depending upon the scenario... Here the dimensions of AP1=[x,y] always, C{1} will be something like {a,b;c,d; e,f;g,h;}, where the length is "j" and from C{2} onward the matrix will be multidimensional... so that's where i need to code efficiently so i can get the desired APconfig.
s=1;
for i=1: length(C{1})
for j=1: length(C{2})
for k=1:length(C{2}{j})
for l=1: length(C{3})
for m=1:length(C{3}{l})
APconfig(s,:)=[{Ap1} {C{1}(i,:)} {C{2}{j}(k,:)} {C{3}{l}(m,:)}];
s=s+1;
end
end
end
end
end
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!