There is a built-in funtion included with the financial toolbox.
1) daysact - It can return the number of days between two dates. If you data contains the same number of elements in the year, you can use this function to know where to stop reading the data, exactly in Jun 31.
numDays = daysact('1-jan-2019', '31-jun-2019');
newData = data(1:numDays);