function [error,data,duration, chlabel] = ReadAxionChannel(obj) %well does not exist jump to another and display...might be not %recorded or so %jump to the next %if channel (single)does not exist then display channel not recorded %next data = []; %there in Meeri's code to return at least something with e.g. error=1 %error = 0; %duration = []; m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1)); fid = H5F.open(obj.getCurrentFile()); gid = H5G.open(fid,['/Data/' m_well]); while ~H5L.exists(gid,'slink','H5P_DEFAULT') fprintf([mwell 'seems to be excluded\n']); obj = obj.JumpNextWell; m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1)); gid = H5G.open(fid,['/Data/' m_well]); end %m_well=strcat(char(64+obj.last_well_row+1),num2str(obj.last_well_col+1)); m_ch=strcat(num2str(obj.last_ch_col+1),num2str(obj.last_ch_row+1)); chlabel = strcat(m_well,'_',m_ch); % which well which electrode disp(['now reading: ' chlabel]); try data = h5read(obj.getCurrentFile(),['/Data/' m_well '/' m_ch]); %if isempty(obj.duration) %duration = length(data)/obj.samplerate; %obj.duration = duration; %else %duration = obj.duration;%better when open file????? %end error = 0; catch %err error = 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 end end end %% function obj = JumpNextWell(obj) 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!'); obj.file_finished = 1; else obj.last_well_row = obj.last_well_row+1; end else obj.last_well_col = obj.last_well_col+1; end end