This question is closed. Reopen it to edit or answer.
How do select values in one table which match those in another...
1 view (last 30 days)
Show older comments
Louise Wilson on 16 Oct 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
I have two tables which look like the following. Where the MMSI number in column one of IMO_file matches Var4 in AISfile, I want to extract the MMSI, IMO and Callsign from IMO_file and add it to columns 5:7 of AIS file. I am having trouble doing this!
I have tried here below, but I cannot get the variables into the correct classes to allow this to work... and even then, is there a simpler way to do this than a forloop?
%for each filtered AIS file, we wanna loop through relevant month of
IMO_AIS=strcat('Y:\AIS data\',YRmonth,'\input_data\not required');
if (pathparts(3)=='ITU5') %only ITU5 files have IMO data
Cris LaPierre on 17 Oct 2020
Edited: Cris LaPierre on 17 Oct 2020
If you are unfamiliar with joining tables, I suggest using the Join Tables task in the live editor. This allows you to interactively explore various settings until you get the result you want.
Cris LaPierre on 19 Oct 2020
That's interesting. Your tables don't seem to be that large. Can you share your two tables in a mat file? You can attach them using the paper clip icon.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!