i want vector which is long size and each time size change but pattren is same in putting value
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
vector like this....i want in this sequence..this is for 1 to 8 row
=[ 2 1 4 3 6 5 8 7
3 1 5 3 7 5 1 7
4 1 6 3 8 5 2 7
5 1 7 3 1 5 3 7
6 1 8 3 2 5 4 7
7 1 1 3 3 5 5 7
8 1 2 3 4 5 6 7]
if size is increase than row change but sequence is same if 12 row than vector = [
2 1 4 3 6 5 8 7 10 9 12 11
3 1 5 3 7 5 9 7 11 9 1 11
4 1 6 3 8 5 10 7 12 9 2 11
5 1 7 3 9 5 11 7 1 9 3 11...............]
sequence is odd term remain same but even number move forward in sequence
4 Commenti
Jan
il 18 Dic 2016
This is a strange question. I do not have any idea about what you are searching for. What are the inputs, what is variable and what is fixed, and what do you want as output?
Risposte (1)
Roger Stafford
il 18 Dic 2016
Let your resulting matrix, M, have m rows and n columns.
b = mod(0:n-1,2)==0;
M = repmat((1:n).*b+(-1:n-2).*(~b),m,1);
M = mod(M+bsxfun(@times,(0:m-1).',b),n)+1;
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!