How to determine inequality in an array
2 views (last 30 days)
Show older comments
I have a set of 3D volumes with multiple regions. I wanted to set to one the regions with particular numbers and all the rest of voxels to zero. My code is as shown below, but I wonder if there is a better way to write those lines of code.
tissue(tissue ~=24 & tissue ~=31 & tissue ~=32 & tissue ~=33 & tissue ~=37 & tissue ~=38 & tissue ~=39 & tissue ~=40 & tissue ~=41 & ...
tissue ~=42 &tissue ~=43 & tissue ~=44 & tissue ~=48 & tissue ~=49 & tissue ~=54 & tissue ~=55 & tissue ~=56 & tissue ~=57 & ...
tissue ~=58 & tissue ~=59 & tissue ~=60 & tissue ~=61 & tissue ~=62 & tissue ~=63 & tissue ~=64 & tissue ~=65 & tissue ~=66 & ...
tissue ~=67 & tissue ~=70 & tissue ~=72 & tissue ~=73 & tissue ~=74 & tissue ~=76 & tissue ~=77 & tissue ~=81 & ...
tissue ~=82 & tissue ~=83 & tissue ~=84 & tissue ~=85 & tissue ~=86 & ...
tissue ~=87 & tissue ~=89 & tissue ~=90 & tissue ~=91 & tissue ~=92 & tissue ~=93 & tissue ~=94 & tissue ~=96 & ...
tissue ~=97 & tissue ~=101 & tissue ~=102 & tissue ~=103 & tissue ~=104 & tissue ~=105 & tissue ~=106 & tissue ~=107 & ...
tissue ~=108 & tissue ~=109 & tissue ~=110 & tissue ~=113 & tissue ~=114 & tissue ~=115 & tissue ~=116 & tissue ~=117 & ...
tissue ~=118 & tissue ~=119 & tissue ~=120 & tissue ~=121 & tissue ~=122 & tissue ~=123 & tissue ~=124 & tissue ~=125 & ...
tissue ~=126 & tissue ~=129 & tissue ~=130 & tissue ~=133 & tissue ~=134 & tissue ~=135 & tissue ~=136 & tissue ~=137 & ...
tissue ~=138 & tissue ~=139 & tissue ~=140 & tissue ~=141 & tissue ~=142 & tissue ~=143 & tissue ~=144 & tissue ~=145 & ...
tissue ~=146 & tissue ~=147 & tissue ~=148 & tissue ~=149 & tissue ~=150 & tissue ~=151 & tissue ~=152 & tissue ~=153 & ...
tissue ~=154 & tissue ~=155 & tissue ~=156 & tissue ~=157 & tissue ~=158 & tissue ~=161 & tissue ~=162 & tissue ~=163 & ...
tissue ~=164 & tissue ~=165 & tissue ~=166 & tissue ~=167 & tissue ~=168 & tissue ~=169 & tissue ~=170 & tissue ~=171 & ...
tissue ~=172 & tissue ~=173 & tissue ~=174 & tissue ~=175 & tissue ~=176 & tissue ~=177 & tissue ~=178 & tissue ~=179 & ...
tissue ~=180 & tissue ~=181 & tissue ~=182 & tissue ~=183 & tissue ~=184 & tissue ~=185 & tissue ~=186 & tissue ~=187 & ...
tissue ~=188 & tissue ~=191 & tissue ~=192 & tissue ~=193 & tissue ~=194 & tissue ~=195 & tissue ~=196 & tissue ~=197 & ...
tissue ~=198 & tissue ~=199 & tissue ~=200 & tissue ~=201 & tissue ~=202 & tissue ~=203 & tissue ~=204 & tissue ~=205 & ...
tissue ~=206 & tissue ~=207 & tissue ~=208)=0;
tissue(tissue ~= 0) = 1;
0 Comments
Answers (1)
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!