|
@@ -63,7 +63,13 @@ classdef FileRunner
|
|
|
|
|
|
% onnistuiko,indexes,spikes,chlabel,duration,record_time,detection threshold,noise
|
|
|
function [r_result, obj] = ReadSpikesFromNextChannel(obj) % palauttaa seuraavan kanavan indexes & waves etc
|
|
|
-
|
|
|
+ %curr_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
|
|
|
+ %splitter=@(x) strsplit(x, '/');
|
|
|
+ %while ~any(strcmp(cellfun(@(z) z{end}, cellfun(splitter,{h5info(obj.getCurrentFile()).Groups(1).Groups.Name}, 'UniformOutput',false), 'UniformOutput',false), curr_well))
|
|
|
+ %fprintf([curr_well '_' 'seems to be excluded\n']);
|
|
|
+ %obj = obj.JumpNextWell;
|
|
|
+ %curr_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
|
|
|
+ %end
|
|
|
% onko viel? elektrodeita, jotka pit?isi lukea
|
|
|
if obj.file_finished &&...% jos oli viimeinen tai eka kanava
|
|
|
obj.last_file >= length(obj.files) % ja jos ei ole tiedostoja jotka pit?isi lukea
|
|
@@ -79,8 +85,9 @@ classdef FileRunner
|
|
|
if obj.file_finished&&...
|
|
|
obj.last_file>0
|
|
|
Finalcsv=sortrows(obj.T, 2);
|
|
|
- thefilename=strsplit(obj.getCurrentFile(), '.');
|
|
|
- thefilename=thefilename{1};
|
|
|
+ thefilenamefull=strsplit(obj.getCurrentFile(), '.');
|
|
|
+ thefilename=strsplit(thefilenamefull{1}, '\');
|
|
|
+ thefilename=thefilename{end};
|
|
|
writetable(Finalcsv, strcat(obj.csv_directory, '\',thefilename,'_', 'spikes.csv'));
|
|
|
obj.T=table; %zeroing the table
|
|
|
obj = obj.OpenNewFile();
|
|
@@ -92,6 +99,8 @@ classdef FileRunner
|
|
|
|
|
|
%if ~obj.file_read_error
|
|
|
%Reading the channel
|
|
|
+
|
|
|
+
|
|
|
[r_result.error,m_data, r_result.chlabel, obj] = obj.ReadAxionChannel();
|
|
|
|
|
|
%disp(r_result.chlabel)
|
|
@@ -115,7 +124,7 @@ classdef FileRunner
|
|
|
|
|
|
|
|
|
|
|
|
- function [error,data,chlabel, obj] = ReadAxionChannel(obj)
|
|
|
+ function [errorread,data,chlabel, obj] = ReadAxionChannel(obj)
|
|
|
|
|
|
%well does not exist jump to another and display...might be not
|
|
|
%recorded or so
|
|
@@ -127,11 +136,15 @@ classdef FileRunner
|
|
|
%error = 0;
|
|
|
%duration = [];
|
|
|
m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
|
|
|
+
|
|
|
splitter=@(x) strsplit(x, '/');
|
|
|
while ~any(strcmp(cellfun(@(z) z{end}, cellfun(splitter,{h5info(obj.getCurrentFile()).Groups(1).Groups.Name}, 'UniformOutput',false), 'UniformOutput',false), m_well))
|
|
|
fprintf([m_well '_' 'seems to be excluded\n']);
|
|
|
obj = obj.JumpNextWell;
|
|
|
m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1));
|
|
|
+ if obj.file_finished == 1
|
|
|
+ break
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
m_ch=strcat(num2str(obj.last_ch_col+1),num2str(obj.last_ch_row+1));
|
|
@@ -146,14 +159,14 @@ classdef FileRunner
|
|
|
%else
|
|
|
%duration = obj.duration;%better when open file?????
|
|
|
%end
|
|
|
- error = 0;
|
|
|
+ errorread = 0;
|
|
|
catch %err
|
|
|
- error = 1;
|
|
|
+ errorread = 1;
|
|
|
InactiveChannels=h5read(obj.getCurrentFile(), '/DataInfo/InactiveChannels');
|
|
|
if any(contains(InactiveChannels, chlabel))
|
|
|
disp(['Channel' ' ' chlabel ' ' 'is inactive, it is not recorded in the initial analysed file.'])
|
|
|
else
|
|
|
- disp(['Smth wrong with' ' ' chlabel ' ' 'channel reading!']); %ADDED
|
|
|
+ error(['Smth wrong with' ' ' chlabel ' ' 'channel reading!']); %ADDED
|
|
|
end
|
|
|
|
|
|
end
|
|
@@ -167,7 +180,7 @@ classdef FileRunner
|
|
|
if obj.final_well_col-1 <= obj.last_well_col % viimeinen kaivosarake, otetaan seuraavalta rivilt?
|
|
|
obj.last_well_col = obj.first_well_col-1;
|
|
|
if obj.final_well_row-1 <= obj.last_well_row
|
|
|
- disp('All channels have been read from!');
|
|
|
+ disp('All channels have been read from1!');
|
|
|
obj.file_finished = 1;
|
|
|
else
|
|
|
obj.last_well_row = obj.last_well_row+1;
|
|
@@ -253,7 +266,7 @@ classdef FileRunner
|
|
|
if obj.final_well_col-1 <= obj.last_well_col
|
|
|
obj.last_well_col = obj.first_well_col-1;
|
|
|
if obj.final_well_row-1 <= obj.last_well_row
|
|
|
- disp('All channels have been read from!');
|
|
|
+ disp('All channels have been read from2!');
|
|
|
obj.file_finished = 1;
|
|
|
else
|
|
|
obj.last_well_row = obj.last_well_row+1;
|