How do you use 'if' to stop an empty Matrix block from displaying? On a complex page, where there are different sections that need to be present in the template, but may not all have content added via Craft entries I need to stop the empty areas from being output (e.g. a set of div's that will create an ugly empty space in the page).  

I can successfully do this for empty simple entries - like this:

{% if entry.modelTitleType %}
    &lt;div class="col-1-1"&gt;
        &lt;h2&gt;{{ entry.modelTitleType }}&lt;/h2&gt;
        &lt;p&gt;{{ entry.modelIntroType }}&lt;/p&gt;
    &lt;/div&gt;
{% endif %}


So the div enclosed by the 'if' statement is only output if there's an entry added for 'modelTitleType'.  But I cannot get this to work for a Matrix entry!

How do I wrap an 'if' statement around a Matrix block like this, so it is only output if there's data added?

&lt;ul class="selector padded-top inline-list"&gt;
    {% for block in entry.modelDataType1 %}
        {% if block.type == "type" %}
            &lt;li&gt;&lt;a class="button-list selected" id="show-type1" title="{{ block.typeName }}"&gt;{{ block.typeName }}&lt;/a&gt;&lt;/li&gt;
        {% endif %}
    {% endfor %}
    {% for block in entry.modelDataType2 %}
        {% if block.type == "type" %}
            &lt;li&gt;&lt;a class="button-list" id="show-type2" title="{{ block.typeName }}"&gt;{{ block.typeName }}&lt;/a&gt;&lt;/li&gt;
        {% endif %}
    {% endfor %}
&lt;/ul&gt;


I've tried:

{% if entry.modelDataType1 %}


But this doesn't work...

Any help would be very much appreciated!

Many thanks.
If a Matrix field / block is empty it won't output at all but you can try checking the length in an if statement like:

{% if entry.modelDataType1 | length %}
    // matrix content here
{% endif %}