Add code snippets
This commit is contained in:
25
matlab/catalog/extractColumns.m
Normal file
25
matlab/catalog/extractColumns.m
Normal file
@@ -0,0 +1,25 @@
|
||||
%
|
||||
% -----------------
|
||||
% Copyright © 2019 ACK Cyfronet AGH, Poland.
|
||||
%
|
||||
% This work was partially funded by EPOS Project funded in frame of PL-POIR4.2
|
||||
% --------------
|
||||
%
|
||||
function [varargout] = extractColumns(catalog, varargin)
|
||||
for i=1:length(varargin)
|
||||
colName = varargin{i};
|
||||
varargout{i} = findColumn(catalog, colName);
|
||||
end
|
||||
end
|
||||
|
||||
function column = findColumn(catalog, colName)
|
||||
for c=1:length(catalog)
|
||||
if strcmp(catalog(c).field, colName)
|
||||
column = catalog(c).val;
|
||||
break;
|
||||
end
|
||||
end
|
||||
if exist('column') ~= 1
|
||||
error('no column named %s', colName);
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user