how i can select a part or section in the matrix

36 views (last 30 days)
i have a matrix as shown in the file i need to select specific section in the matrix and then do on it my equation .
i have 8*8 bit matrix inside 16*16 bit matrix . I want when it reaches the number 8 it jumps or goes to 17 and when it completes to 24 and goes to 33 and at 33 it continues to 40 and at the 40 it leaves and goes to 49 and continues to 56 and so on until the matrix 8 * 8 is completed as shown in the attached file. please if any one . Please if anyone has an idea please help me and I would be grateful to him

Accepted Answer

Voss
Voss on 28 Dec 2021
Like this?
A = reshape(1:256,16,16).' % construct 16-by-16 matrix as in the file
A = 16×16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
% Take the 8-by-8 matrix that is the upper-left quarter of A
B = A(1:8,1:8)
B = 8×8
1 2 3 4 5 6 7 8 17 18 19 20 21 22 23 24 33 34 35 36 37 38 39 40 49 50 51 52 53 54 55 56 65 66 67 68 69 70 71 72 81 82 83 84 85 86 87 88 97 98 99 100 101 102 103 104 113 114 115 116 117 118 119 120
  6 Comments
Zeina Abdullah
Zeina Abdullah on 30 Dec 2021
%clear all
%clc
dim =24; % define square matrix dimention
x = [];
coun = 1;
for i=1:dim:(dim.^2-dim+1)
row = [i:i+dim-1];
x = [x;row];
end
Input_Index = x; % generate square matrix in order ascending index
% ==========================================
% Generate Chaotic interleaver Scheme
%==========================================
%-------------------(1)-------------------------
part1 = [];
for i =1:2
part1_i =x(dim:-1:dim/2 + 1,i)';
part1 = [part1 part1_i];
end
part1;
%-------------------(2)-------------------------
part2 = [];
for i =1:2
part2_i =x(dim/2:-1:1,i)';
part2 = [part2 part2_i];
end
part2;
%-------------------(3)-------------------------
part3 = [];
for i =3:4
part3_i =x(dim:-1:dim/2 + 1,i)';
part3 = [part3 part3_i];
end
part3;
%-------------------(4)-------------------------
part4 = [];
for i =3:4
part4_i =x(dim/2:-1:1,i)';
part4 = [part4 part4_i];
end
part4;
%-------------------(5)-------------------------
part5 = [];
for i =5:6
part5_i =x(dim:-1:dim/2 + 1,i)';
part5 = [part5 part5_i];
end
part5;
%-------------------(6)-------------------------
part6 = [];
for i =5:6
part6_i =x(dim/2:-1:1,i)';
part6 = [part6 part6_i];
end
part6;
%-------------------(7)-------------------------
part7 = [];
for i =7:8
part7_i =x(dim:-1:dim/2 + 1,i)';
part7 = [part7 part7_i];
end
part7;
%-------------------(8)-------------------------
part8 = [];
for i =7:8
part8_i =x(dim/2:-1:1,i)';
part8 = [part8 part8_i];
end
part8;
%-------------------(9)-------------------------
part9 = [];
for i =9:12
part9_i =x(dim:-1:dim/2 + dim/4+1,i)';
part9= [part9 part9_i];
end
part9;
%-------------------(10)-------------------------
part10 = [];
for i =9:12
part10_i =x(dim/2+dim/4:-1:dim/2+1 ,i)';
part10= [part10 part10_i];
end
part10;
%-------------------(11)-------------------------
part11= [];
for i =9:12
part11_i =x(dim/2:-1:dim/4+1 ,i)';
part11= [part11 part11_i];
end
part11;
%-------------------(12)-------------------------
part12= [];
for i =9:12
part12_i =x(dim/4:-1:1 ,i)';
part12= [part12 part12_i];
end
part12;
%-------------------(13)-------------------------
part13 = [];
for i =13:16
part13_i =x(dim:-1:dim/2 + dim/4+1,i)';
part13= [part13 part13_i];
end
part13;
%-------------------(14)-------------------------
part14= [];
for i =13:16
part14_i =x(dim/2+dim/4:-1:dim/2+1 ,i)';
part14= [part14 part14_i];
end
part14;
%-------------------(15)-------------------------
part15= [];
for i =13:16
part15_i =x(dim/2:-1:dim/4+1 ,i)';
part15= [part15 part15_i];
end
part15;
%-------------------(16)-------------------------
part16= [];
for i =13:16
part16_i =x(dim/4:-1:1 ,i)';
part16= [part16 part16_i];
end
part16;
%-------------------(17)-------------------------
part17 = [];
for i =17:20
part17_i =x(dim:-1:dim/2 + dim/4+1,i)';
part17= [part17 part17_i];
end
part17;
%-------------------(18)-------------------------
part18= [];
for i =17:20
part18_i =x(dim/2+dim/4:-1:dim/2+1 ,i)';
part18= [part18 part18_i];
end
part18;
%-------------------(19)-------------------------
part19= [];
for i =17:20
part19_i =x(dim/2:-1:dim/4+1 ,i)';
part19= [part19 part19_i];
end
part19;
%-------------------(20)-------------------------
part20= [];
for i =17:20
part20_i =x(dim/4:-1:1 ,i)';
part20= [part20 part20_i];
end
part20;
%-------------------(21)-------------------------
part21 = [];
for i =21:24
part21_i =x(dim:-1:dim/2 + dim/4+1,i)';
part21= [part21 part21_i];
end
part21;
%-------------------(22)-------------------------
part22= [];
for i =21:24
part22_i =x(dim/2+dim/4:-1:dim/2+1 ,i)';
part22= [part22 part22_i];
end
part22;
%-------------------(23)-------------------------
part23= [];
for i =21:24
part23_i =x(dim/2:-1:dim/4+1 ,i)';
part23= [part23 part23_i];
end
part23;
%-------------------(24)-------------------------
part24= [];
for i =21:24
part24_i =x(dim/4:-1:1 ,i)';
part24= [part24 part24_i];
end
part24;
Chaotic_Interleaver_index = [part24;part23;part22;part21;part20;part19;part18;part17;part16;part15;part14;part13 ...
;part12;part11;part10;part9;part8;part7;part6;part5;part4;part3;part2;part1];
Chaotic_Interleaver_index_frame = [part24,part23,part22,part21,part20,part19,part18,part17,part16,part15,part14,part13 ...
,part12,part11,part10,part9,part8,part7,part6,part5,part4,part3,part2,part1];
Zeina Abdullah
Zeina Abdullah on 30 Dec 2021
@Benjamin iam add a new question about this problem in my profile if you can please answer me . and i will add Accepted Answer to you

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!