Extracting text frequency to compare large datasets
Mostrar comentarios más antiguos
Please can you help me to extract the frequency at which each port receives each gear type. The data set is huge, so I need MATLAB to read through and give results for the frequency of Appledoor "Pots and Traps", for example, so that can then be compared with Appledoor "Demersal trawl/seine" or Arbroath "Pots and traps" if needed. They are currently in two columns in an Excel workbook.
Port of Landing Gear Category
Appledore Pots and traps
Appledore Pots and traps
Arbroath Demersal trawl/seine
Arbroath Pots and traps
Arbroath Pots and traps
Arbroath Demersal trawl/seine
Ardglass Demersal trawl/seine
Ardglass Demersal trawl/seine
Ardglass Demersal trawl/seine
Ardglass Pots and traps
Ardglass Pots and traps
Aberdaran Pots and traps
Aberdaran Pots and traps
Aberdeen Pots and traps
1 comentario
Image Analyst
el 14 de Jun. de 2019
Make it easy for people to help by attaching an Excel workbook.
Respuestas (1)
Image Analyst
el 14 de Jun. de 2019
Try histogram2():
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fontSize = 20;
ca = {...
'Appledore' 'Pots and traps'; ...
'Appledore' 'Pots and traps'; ...
'Arbroath' 'Demersal trawl/seine'; ...
'Arbroath' 'Pots and traps'; ...
'Arbroath' 'Pots and traps'; ...
'Arbroath' 'Demersal trawl/seine'; ...
'Ardglass' 'Demersal trawl/seine'; ...
'Ardglass' 'Demersal trawl/seine'; ...
'Ardglass' 'Demersal trawl/seine'; ...
'Ardglass' 'Pots and traps'; ...
'Ardglass' 'Pots and traps'; ...
'Aberdaran' 'Pots and traps'; ...
'Aberdaran' 'Pots and traps'; ...
'Aberdeen' 'Pots and traps'}
ports = ca(:, 1)
gear = ca(:, 2)
[portGroups, portNames] = findgroups(ports)
[gearGroups, gearNames] = findgroups(gear)
h = histogram2(portGroups, gearGroups)
xticks(unique(portGroups));
yticks(unique(gearGroups));
zticks(1:max(h.BinCounts(:)))
xticklabels(portNames);
yticklabels(gearNames);
xlabel('Port', 'FontSize', fontSize)
ylabel('Gear', 'FontSize', fontSize);

1 comentario
Amelia Newman
el 14 de Jun. de 2019
Categorías
Más información sobre Use COM Objects in MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!