Using cellfun to pull information
显示 更早的评论
Hopefully I can explain this!
I have the following code:
clear;
clc;
%--------------------------------------------------------------------------
% Table 1
Color1 = ["Blue"; "Orange";"Purple";"Blue";"Fuschia";"Red"];
LiscensePlate1 = [12569;12897;56783;45231;78999;99999];
t1first = datetime(2021,1,1,0,0,0);
t2first = datetime(2021,1,1,3,0,0);
tfirst = t1first:minutes(35):t2first;
tfirst=tfirst';
cars1 = table(Color1,LiscensePlate1,tfirst);
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Table 2
Color2 = ["Blue"; "Orange";"Purple";"Blue";"Fuschia";"Red"];
LiscensePlate2 = [88888;12897;77777;45231;88999;99999];
t1second = datetime(2022,1,1,2,0,0);
t2second = datetime(2022,1,1,5,0,0);
tsecond = t1second:minutes(35):t2second;
tsecond=tsecond';
cars2 = table(Color2,LiscensePlate2,tsecond);
%--------------------------------------------------------------------------
For this example, say I am out watching cars on my street corner on two different days and I write down the above information (color, liscense plate number, and the time I saw the car).
Is there any way to use cellfun to search between the two tables and see if any of the liscense plate numbers match? If they match, how would I then pull the time I saw the cars and see when the difference is between the time I first saw the car and the second?
I know with a table this small and I could look for the matching liscense plates easily but I am actually dealing with a larger data set and would need this automated (cellfun) if possible!
Thank you in advance for all of your help!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!