MATLAB: How to get the column and vector of 2nd ones in a matrices

3d matricesarraymatricesvector

I have 3D matrices
t(:,:,1) =
1 10 19 28 37 46 55 64 73 82
2 11 20 29 38 47 56 65 74 83
3 12 21 30 39 48 57 66 75 84
4 13 22 31 40 49 58 67 76 85
5 14 23 32 41 50 59 68 77 86
6 15 24 33 42 51 60 69 78 87
7 16 25 34 43 1 61 70 79 88
8 17 26 35 44 53 1 1 80 89
9 18 27 36 45 54 63 72 1 1
t(:,:,2) =
91 100 109 118 127 136 145 154 163 172
92 101 110 119 128 137 146 155 164 173
93 102 111 120 129 138 147 156 165 174
94 103 112 121 130 139 148 157 166 175
95 104 113 122 131 140 149 158 167 176
96 105 114 123 132 141 150 159 168 177
97 106 115 124 133 142 151 160 169 178
98 107 116 125 134 143 152 161 170 179
99 108 117 126 135 144 153 162 171 180
How can I get the coordinates of the 1st ones which is at 52 in t(:,:,1) and copy the number to the same column at 1st row in t(:,:,2)? So that the result will be as follow:
t(:,:,2) =
91 100 109 118 127 136 145 154 163 172
92 101 110 119 128 137 146 155 164 173
93 102 111 120 129 138 147 156 165 174
94 103 112 121 130 139 148 157 166 175
95 104 113 122 131 140 149 158 167 176
96 105 114 123 132 141 150 159 168 177
1 106 115 124 133 142 151 160 169 178
98 107 116 125 134 143 152 161 170 179
99 108 117 126 135 144 153 162 171 180

Best Answer

[idx,idy]=find(ismember(t(:,:,2),97));
t(idx,idy,2)=1