I need to extract items from a timetable (timetable1) matching specific dates (time2).
timetable1=['01-Jan-1983' -2.374'01-Feb-1983' -2.290'01-Mar-1983' -1.723'01-Apr-1983' -2.117'01-May-1983' -2.775'01-Jun-1983' -2.913 '01-Jul-1983' -2.492'01-Aug-1983' -2.256'01-Sep-1983' -1.739'01-Oct-1983' -1.108'01-Nov-1983' -0.675'01-Dec-1983' -0.602] time2=['01-Jan-1983''01-Feb-1983''01-Mar-1983''01-Apr-1983''01-May-1983''01-Jun-1983''01-Jul-1983']for j=1:12 timetable2(j,:)=arrayfun(@(x) timetable1.Var1(timetable1.time==x,j),time2,'UniformOutput','false') end
Normally I would use the arrayfun code above for this type of function but when I try it with timetable data, it produces this error:
Error using arrayfun
All of the input arguments must be of the same size and shape.
Previous inputs had size 81 in dimension 1. Input #3 has size 1
Is there a way to extract timetable data in this manner?
Best Answer