Check if a value exists in a Matrix field http://sanderson.brycekirk.com/floor-plans/1-bedroom-1-bathroom/f123-f148-f248

This page displays a floor plan, of which there are many. Currently, within each floorplan entry, you add the floors it is on, along with the image of each floor:

I'm using a for loop to display a big button for each available floor, as you can see on the linked page.

My problem: I want to add disabled buttons for each floor the floorplan isn't on, but I can't figure out how to do it.

The logic should be something like this ("floors" is the name of the matrix field, "floor" is the block type handle):

IF '1' exists in entry.floors.floor.floorNumber
    Show the big selectable '1' button
ELSE 
    Show the disabled '1' button

IF '2' exists in entry.floors.floor.floorNumber
    Show the big selectable '2' button
ELSE 
    Show the disabled '2' button

etc for 3 and 4


It seems like their should be some straightforward solution, but I've had no luck.

Current code for displaying the floor number buttons:

{% for floor in entry.floors.all() %}
{% if floor.type.handle == 'floor' %}
    &lt;li class="tabs-title {% if loop.first %}is-active{% endif %}"&gt;&lt;a href="#panel{{ floor.floorNumber }}" {% if loop.first %}aria-selected="true"{% endif %}&gt;&lt;img src="{{ siteUrl }}assets/img/{{ floor.floorNumber }}.png" alt="{{ floor.floorNumber }}" /&gt;&lt;/a&gt;&lt;/li&gt;
{% endif %}
{% endfor %}


Floor matrix:
You can check if certain elements match for your Query via exists()

entry.floors.type('floor').floorNumber(1).exists()


returns true or false. However keep in mind entry.floors returns an element of type Query and you'll append the parameters type and floorNumber to the Query. These properties won't reset magically since you call the object by reference and not by value thus you'll either need to reset them

{% do entry.floors.type(null).floorNumber(null) %}


or you don't use the object directly and clone/copy it instead 

{% set exists = clone(entry.floors).type('floor').floorNumber(1).exists() %}