MATLAB: Creating a for loop to see if date exists

cell arraysfindfor loopindexingposition;

I have two array with date, first array have multiple dates in 5×3 cell such as each cell have year, month, and date in it:
firstarray=[2019 5 03;
2019 4 03;
2019 4 05;
2019 4 06;
2019 3 05]
Another array is 1×3 which has the date I am looking for.
[2019 4 05]
How can I create a for loop to find that date and find the position of where it is located?

Best Answer

If you insist or keeping it as a double, you can use ismember three times, but it makes more sense to make use of the datetime class.
first=[2019 5 03;
2019 4 03;
2019 4 05;
2019 4 06;
2019 3 05];
test=[2019 4 05];
first=datetime(first(:,1),first(:,2),first(:,3));
test=datetime(test(:,1),test(:,2),test(:,3));
pos=find(ismember(first,test));
date=first(pos);