 <p>You can solve this problem with the mod(...) function and proper use of brackets and referencing. Consider</p> <ol> <li><code>Mod(x,3)</code> will return zero if your number is a multiple of 3. <code>mod(x,2)</code> will return 1 if x is odd.</li> <li>You can get all your <code>a1</code> or <code>a2</code> values in a vector by typing <code>[a.a1]</code>. Just typing a.a1 gives a mess.</li> <li>You can filter our from your <code>a</code> structure by writing <code>a = a([1 3]);</code> or by writing <code>a = a(logical([1 0 1]))</code> to get the same result.</li> <li>You can use the <code>&amp;</code> for <em>logical and</em> and <code>|</code> for logical or (<a href="http://www.mathworks.com/help/techdoc/ref/logicaloperatorselementwise.html" rel="nofollow">see here</a>).</li> </ol> <p>Altogether, the following code solves your problem:</p> <pre><code>%% Part 1: a= struct('a1',{1,2,3},'a2',{4,5,6}); logForA1isMod3 = (mod([a.a1], 3) == 0); logForA2isMod3 = (mod([a.a2], 3) == 0); a = a(logForA1isMod3 &amp; logForA2isMod3); %% Part 2: a= struct('a1',{1,2,3},'a2',{4,5,6}); logForA1isOdd = (mod([a.a1], 2) == 1); a = a(logForA1isOdd | logForA2isMod3); </code></pre>