forked from episodes-platform/shared-snippets
Add documentation for matlab files
This commit is contained in:
@@ -3,11 +3,25 @@
|
||||
% Copyright © 2022 ACK Cyfronet AGH, Poland.
|
||||
% --------------
|
||||
%
|
||||
% Returns index of the column with the specified colName within the given catalog
|
||||
%
|
||||
% TODO use this function in extractColumns.m
|
||||
function columnIdx = findCatalogColumn(catalog, colName)
|
||||
for c=1:length(catalog)
|
||||
% FINDCATALOGCOLUMN Find the index of a column in a catalog
|
||||
%
|
||||
% columnIdx = FINDCATALOGCOLUMN(catalog, colName) returns the index of
|
||||
% the column with the specified name within the given catalog structure.
|
||||
% The catalog is expected to be an array of structures where each
|
||||
% structure has a 'field' representing the column name.
|
||||
%
|
||||
% Example:
|
||||
% catalog(1).field = 'ID'; catalog(2).field = 'Time';
|
||||
% idx = findCatalogColumn(catalog, 'Time');
|
||||
% % Result: idx = 2
|
||||
%
|
||||
% Note: This function is intended to be used in conjunction with other
|
||||
% catalog processing functions.
|
||||
%
|
||||
% See also: EXTRACTCOLUMNS.
|
||||
|
||||
for c = 1:length(catalog)
|
||||
if strcmp(catalog(c).field, colName)
|
||||
columnIdx = c;
|
||||
break;
|
||||
@@ -16,4 +30,4 @@ function columnIdx = findCatalogColumn(catalog, colName)
|
||||
if exist('columnIdx') ~= 1
|
||||
error('no column named %s', colName);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user