I have two arrays of dates, A and B, where size(A) > size(B).
A contains multiple entries for each date (it corresponds to a cell containing various data). B is simply all dates between the start and end date, but also correspond to certain data.
I want to create and array, C (where size(C) == size(A), containing the row number in B corresponding to the date on each row in A (so that data can be cross-referenced, i.e. perform a calculation based on data in A and B, using the row index of B to match dates).
I can do this using a loop and the find function:
for i=length(A)
C(i) = find(A(i) == B);
end
However, this is probably not the most efficient solution (takes quite a long time given my large data set). I'd "prefer" simply C = find(A == B), but Matlab does not allow this.
Is there a way to achieve the same result not using a loop?
Many thanks for any help!
Cto be a cell array? - Eitan TCcan be a 1-D array only ifBcontains unique values (i.e no repeating values). Are you okay with that? - Eitan T