def matchCalendars(calendars):
    """
    Matches calendars against each other

    :param calendars: array containing all calendars to match
    :type calendars: array
    :return: Matched calendarpattern
    :rtype: dict
    """
    calendarPattern = []
    for i in range(24):
        calendarPattern.append(i)
        calendarPattern[i] = []
        for j in range(4):
            calendarPattern[i].append(j)
            calendarPattern[i][j] = 0
    for calendar in calendars:
        if calendar is not None:
            for i in range(24):
                for j in range(4):
                    if calendar[i][j] == 1:
                        calendarPattern[i][j] = 1
    return calendarPattern
