I would like to know if how I'm plotting my data is an efficient way to go about it. Is this the case? Or does a different way exist, where I create the Structs and then create the plots outside of the for-loop in one go?
What I do:
Multiple plots per day per Rats. And I check for arrays which are not filled with zeroes, those arrays are not interesting. I have the values stored in a nested struct, which I build as follows:
for Rat = vecRat(1):vecRat(end)
for Day = UserDayArray
% I Build an array with Timediff here, which I left out for clarity
Subject(Rat).day(Day). Timediff = Timediff;
if isempty(Subject(Rat).day(Day).CumTimediff) == 0 && max((Subject(Rat).day(Day).CumTimediff)) ~= 0 && min((Subject(Rat).day(Day).CumTimediff)) ~=0
stem(Subject(Rat).day(Day). Timediff) %plots data
end
%Tells User that for this day no shaped trials were found.
elseif isempty(Subject(Rat).day(Day).CumTimediff) == 0
fprintf(['****************** TSBP ', num2str(Rat), ' Day ', num2str(Day),'******************\n']);
fprintf('No Shaping algorythm present/No Timechange detected\n');
fprintf('No plots made\n');
end
end
end