# How to find combination of random number of vectors?

1 visualizzazione (ultimi 30 giorni)
Xiaohan Du il 30 Ott 2017
Commentato: Star Strider il 30 Ott 2017
Hi all,
Function combvec gives the combination of n vectors. Imagine I have a cell C contains m vectors, how can I find combination of all m vectors without manually input all of them in combvec?
I think I can do this:
C = {[1 2 3] [2 3 4 5] [9 8 2]};
for i = 1:2
output = combvec(C{i}, C{i + 1});
end
but it only gives me combination of last 2 vectors. Any ideas?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Star Strider il 30 Ott 2017
Save the results in a cell array:
C = {[1 2 3] [2 3 4 5] [9 8 2]};
for i = 1:2
output{i} = combvec(C{i}, C{i + 1});
end
##### 4 CommentiMostra 2 commenti meno recentiNascondi 2 commenti meno recenti
Xiaohan Du il 30 Ott 2017
Oh, this is really interesting, thanks!
Star Strider il 30 Ott 2017
As always, my pleasure!

Accedi per commentare.

### 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!

Translated by