필터 지우기
필터 지우기

i want vector which is long size and each time size change but pattren is same in putting value

조회 수: 1 (최근 30일)
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
Jan
Jan 2016년 12월 18일
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?
Pratik Anandpara
Pratik Anandpara 2016년 12월 19일
편집: Pratik Anandpara 2016년 12월 19일
example : input is take digit from 1 to 8 output is vector in this pattern
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
here observe one pattern digit is reurn in that pattern 2nd-4th-6th-8th digit remain same and other numbers are in sequence..2nd-4th-6th-8th digit remian same at its place other digit move in sequence from 1 to 8... observe 1st digit-3rd-5th-7th digit in each row it rotate in sequence column wise....but 2nd-4th-6th-8th digit in each row is remain same... observe pls

댓글을 달려면 로그인하십시오.

답변 (1개)

Roger Stafford
Roger Stafford 2016년 12월 18일
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;

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by