Skip to content
Snippets Groups Projects
Commit 8425d9f9 authored by leprob001's avatar leprob001
Browse files

Extended soundsources package.

parent 7a7f5c66
Branches
No related tags found
No related merge requests found
function [soundsourceCombinationsCell] = createCombinationsCell(pSoundsourceCombinationsTable)
%TRACKPARAMETERTOWORKSPACE Summary of this function goes here
% Detailed explanation goes here
%% Create struct for workspace
soundsourceCombinationsCell = table2cell(pSoundsourceCombinationsTable);
end
function [soundsourceCombinationsTable] = createCombinationsTable(pSoundsourceCombinationsCell)
%TRACKPARAMETERTOWORKSPACE Summary of this function goes here
% Detailed explanation goes here
%% Setup variables
variableNames = { ...
'combinationBegin', ...
'combinationEnd', ...
'soundsources', ...
'referencePosition', ...
'soundspeed1', ...
'soundspeed2', ...
'soundspeed3', ...
'soundspeed4', ...
'soundspeed5' ...
};
%
% variableTypes = { ...
% 'double', ...
% 'double', ...
% 'string', ...
% 'string', ...
% 'double', ...
% 'double', ...
% 'double', ...
% 'double', ...
% 'double' ...
% };
%% Create struct for workspace
soundsourceCombinationsTable = cell2table( ...
pSoundsourceCombinationsCell, ...
'VariableNames', ...
variableNames ...
);
% soundsourceCombinationsStruct = struct();
% for i = 1:size(pSoundsourceCombinationsCell, 1)
% if ~isnumeric(pSoundsourceCombinationsCell{i, 1})
% soundsourceCombinationsStruct(i).begin = str2double(pSoundsourceCombinationsCell{i, 1});
% else
% soundsourceCombinationsStruct(i).begin = pSoundsourceCombinationsCell{i, 1};
% end
% soundsourceCombinationsStruct(i).end = str2double(pSoundsourceCombinationsCell{i, 2});
% soundsourceCombinationsStruct(i).soundsources = unique(strsplit( ...
% pSoundsourceCombinationsCell{i, 3} ...
% , ' ')) ;
% soundsourceCombinationsStruct(i).referencePoint = cellfun(@str2double, strsplit( ...
% pSoundsourceCombinationsCell{i, 4}, ' ', ...
% 'CollapseDelimiters', true ...
% ));
% soundsourceCombinationsStruct(i).soundspeed = cellfun( ...
% @str2double, ...
% pSoundsourceCombinationsCell(i, 5:9) ...
% );
% end
end
function [offsetsCell] = createOffsetsCell(pOffsetsStruct, pTableRowNames)
%CREATEOFFSETSCELL Summary of this function goes here
% Detailed explanation goes here
%% Initialize return variable
offsetsCell = cell(length(pTableRowNames), 1);
%% Create cell
for i = 1:length(pTableRowNames)
currentRowName = pTableRowNames{i};
if artoa.data.hasMember(pOffsetsStruct, {currentRowName})
value = pOffsetsStruct.(currentRowName);
else
value = 0;
end
offsetsCell{i} = value;
end
end
function [offsetStruct] = createOffsetsStruct(pOffsetTableRowNames, pOffsetTableData)
%CREATEOFFSETSSTRUCT Summary of this function goes here
% Detailed explanation goes here
%% Initialize return variable
offsetStruct = struct();
%% Convert to struct
rowNames = pOffsetTableRowNames;
for i = 1:length(rowNames)
offsetStruct.(rowNames{i}) = pOffsetTableData{i, 1};
end
end
function [scatterHandle, textHandles] = scatterPositions(pAxesHandle, pSoundsources)
%PLOT Summary of this function goes here
% Detailed explanation goes here
%% Collect required data
fnames = fieldnames(pSoundsources);
plot_names = fnames;
lat = NaN(length(fnames), 1);
lon = NaN(length(fnames), 1);
for i = 1:length(fnames)
lat(i) = pSoundsources.(fnames{i}).position(1);
lon(i) = pSoundsources.(fnames{i}).position(2);
plot_names{i} = {'', [' ' plot_names{i}]};
end
%% Plot positions
hold(pAxesHandle, 'on');
scatterHandle = scatter(pAxesHandle, lon, lat);
textHandles = text(lon, lat, plot_names);
hold(pAxesHandle, 'off');
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment