-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swrtrig spect and some cleaning up of base cmw code
- Loading branch information
Showing
12 changed files
with
640 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
function resultindex = evaluatefilter(cellvar, filterString) | ||
% | ||
% resultindex = evaluatefilter(cellvar, filterString) | ||
% | ||
% Return the indices of the cell structure that have fields that satisfy | ||
% the given constraints. Each row of the output is the index into one cell. | ||
% | ||
% CELLVAR - any cell structure, for example spikes{}{}{}{}.#### | ||
% FILTERSTRING - A string containing an expression with the field variables | ||
% of CELLVAR. Each field variable must be preceded with a | ||
% '$'. | ||
% | ||
% Example: index = evaluatefilter(cellinfo,'(($meanrate < 10) && isequal($area,''CA3''))') | ||
% Returns all indices of cellinfo where the 'area' field is equal to 'CA3' and the 'meanrate' field is less than 10. | ||
|
||
|
||
if ~isequal(filterString, '') | ||
newstruct = []; | ||
[variables, expression] = parsefilterstring(filterString); | ||
for i = 1:length(variables) | ||
varfetch = cellfetch(cellvar, variables{i}); | ||
for j = 1:length(varfetch.values) | ||
|
||
eval(['newstruct(',num2str(j),').',variables{i},' = varfetch.values{j};']); | ||
%newstruct = setfield(newstruct,{j},variables{i},varfetch.values{j}); | ||
|
||
|
||
end | ||
end | ||
|
||
results = []; | ||
for i = 1:length(newstruct) | ||
structVar = newstruct(i); | ||
eval(['tmpresult = ',expression,';']); | ||
if isempty(tmpresult) | ||
tmpresult = 0; | ||
end | ||
results(i) = tmpresult; | ||
end | ||
cellindex = cellfetch(cellvar, ''); | ||
resultindex = cellindex.index(find(results),:); | ||
else | ||
cellindex = cellfetch(cellvar, ''); | ||
resultindex = cellindex.index; | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.