Searching for log entries in SQLite that involve a particular IP subnet
Databases are meant for efficient searching: you formulate a query to specify exactly what data you want to retrieve.  What you are doing is retrieving the entire contents of the table, to be filtered in MATLAB.  That defeats the purpose of the database — you might as well have stored the data in a CSV file.

Just write a query that looks like

SELECT *
    FROM IP_logs
    WHERE src_addr LIKE '91.198.174.%' OR dest_addr LIKE '91.198.174.%';


Depending on what your database schema looks like, you might be able to do even better.  Indexes on the relevant columns would help.  Storing IPv4 addresses as 32-bit integers would result in even faster searches.