Extracting unique rows from cell array Matlab 2015a
古いコメントを表示
Hi,
I have dataset (different data types) that contains thousands of rows
[~,~,data] = xlsread('dataset.csv');
% Extracting particular columns into cell array
Selected_AIS_Data=(data(2:end,[1 2 3 4 6 9 10 18 19 ]));
% Remove NAN rows
Selected_AIS_Data(any(cellfun(@(x) any(isnan(x)),Selected_AIS_Data),2),:) = [];
Test=Selected_AIS_Data(1:10000,:);
% Converting all data type into String
charArr = cellfun(@num2str, Test, 'Un', 0 );
An example of the extracted dataset (i.e., Selected_AIS_Data)
DATE TIME (UTC) MMSI LATITUDE LONGITUDE NAME DESTINATION Estimated Arrival time
'01/01/2021 00:00:10' 720899000 25.7705000000000 -80.1694400000000 'AS SABRINA' 'USMIA' '01/12/1930 06:00:00'
'01/01/2021 00:00:16' 244561000 26.0891800000000 -80.1198700000000 'HOHEBANK' 'USPEF' '01/12/1931 12:40:00'
'01/01/2021 00:00:32' 720899000 25.7683600000000 -80.1644700000000 'BAYOU TECHE' 'MIAMI' '01/10/2023 15:00:00'
'01/01/2021 00:00:56' 244561000 25.7980300000000 -80.0949500000000 'VANQUISH' 'MIAMI ANCHORAGE' '01/12/2029 09:00:00'
'02/01/2021 00:01:00' 720899000 25.4700300000000 -79.8633800000000 'NAIYA' 'MIRAGOANE,HAITI' '01/12/2021 16:00:00'
'02/01/2021 00:01:01' 305134000 25.7971000000000 -80.2463300000000 'BELEN' 'USMIA' '01/12/2028 23:00:00'
'02/01/2021 00:01:11' 244561000 27.7856700000000 -79.9775400000000 'LOUISIANA' 'PORT CANAVERAL,FL' '01/12/1931 06:00:00'
'02/01/2021 00:01:16' 305134000 25.7983200000000 -80.2483700000000 'BIMINI CAT' 'MIAMI FLA US' '01/12/2027 15:30:00'
'02/01/2021 00:01:18' 305134000 26.0947400000000 -80.1219300000000 'OREGON' 'PT EVERGLADES, FL' '01/12/2027 19:00:00'
'03/01/2021 00:01:25' 305134000 26.0730400000000 -80.1178500000000 'FS IPANEMA' 'USPEV' '01/12/1931 06:00:00'
% when the MMSI is the same, I need to extract all relative information as showing bellow
% Expected output
DATE TIME (UTC) MMSI LATITUDE LONGITUDE NAME DESTINATION Estimated Arrival time
'01/01/2021 00:00:10' 720899000 25.7705000000000 -80.1694400000000 'AS SABRINA' 'USMIA' '01/12/1930 06:00:00'
'01/01/2021 00:00:16' 720899000 26.0891800000000 -80.1198700000000 'HOHEBANK' 'USPEF' '01/12/1931 12:40:00'
'02/01/2021 00:01:00' 720899000 25.4700300000000 -79.8633800000000 'NAIYA' 'MIRAGOANE,HAITI' '01/12/2021 16:00:00'
'01/01/2021 00:01:25' 244561000 26.0730400000000 -80.1178500000000 'FS IPANEMA' 'USPEV' '01/12/1931 06:00:00'
'01/01/2021 00:01:11' 244561000 27.7856700000000 -79.9775400000000 'LOUISIANA' 'PORT CANAVERAL,FL' '01/12/1931 06:00:00'
'02/01/2021 00:00:32' 244561000 25.7683600000000 -80.1644700000000 'BAYOU TECHE' 'MIAMI' '01/10/2023 15:00:00'
'01/01/2021 00:01:01' 305134000 25.7971000000000 -80.2463300000000 'BELEN' 'USMIA' '01/12/2028 23:00:00'
'01/01/2021 00:01:16' 305134000 25.7983200000000 -80.2483700000000 'BIMINI CAT' 'MIAMI FLA US' '01/12/2027 15:30:00'
'02/01/2021 00:00:56' 305134000 25.7980300000000 -80.0949500000000 'VANQUISH' 'MIAMI ANCHORAGE' '01/12/2029 09:00:00'
'03/01/2021 00:01:18' 305134000 26.0947400000000 -80.1219300000000 'OREGON' 'PT EVERGLADES, FL' '01/12/2027 19:00:00'
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Shifting and Sorting Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!