MATLAB: Command window outputs 10 times ans = logical 1? See the separate comment, too

for loopif statementlogical?switch

I cannot find where am I missing the semicolon in the following code:
for j = 2:3
for t= 1:10
if j ==2 % Stairs up
for tt=1:2
if length(gait_events{j}{1,t})==3 && length(gait_events{j}{5,t})==3 && strcmp(side,'Left') % Left leg analyzed, starts with Left Leg
switch tt
case 1
idx_50TT{j}(t,tt)= round((gait_events{j}{3,t}(1,1) + gait_events{j}{7,t}(1,1))/2*fs);
case 2
idx_50TT{j}(t,tt)= round((gait_events{j}{3,t}(end,1) + gait_events{j}{2,t}(end,1))/2*fs);
end
elseif length(gait_events{j}{1,t})==3 && length(gait_events{j}{5,t})==3 && strcmp(side,'Right') % Right leg analyzed, starts with Right Leg

switch tt
case 1
idx_50TT{j}(t,tt)= round((gait_events{j}{3,t}(1,1) + gait_events{j}{7,t}(1,1))/2*fs);
case 2
idx_50TT{j}(t,tt)= round((gait_events{j}{7,t}(end,1) + gait_events{j}{6,t}(end,1))/2*fs);
end
else
disp('Not a LL or RR subject');
end
end
else j==3 % Stairs down
for tt=1:2
if length(gait_events{j}{1,t})==3 && length(gait_events{j}{5,t})==3 && strcmp(side,'Left') %Left leg analyzed, starts with Left Leg
switch tt
case 1
idx_50TT{j}(t,tt)= round((gait_events{j}{8,t}(1,1) + gait_events{j}{5,t}(1,1))/2*fs);
case 2
idx_50TT{j}(t,tt)= round((gait_events{j}{3,t}(2,1) + gait_events{j}{1,t}(end,1))/2*fs);
end
elseif length(gait_events{j}{1,t})==3 && length(gait_events{j}{5,t})==3 && strcmp(side,'Right') % Right leg analyzed, starts with Right Leg
switch tt
case 1
idx_50TT{j}(t,tt)= round((gait_events{j}{4,t}(1,1) + gait_events{j}{1,t}(1,1))/2*fs);
case 2
idx_50TT{j}(t,tt)= round((gait_events{j}{7,t}(2,1) + gait_events{j}{5,t}(end,1))/2*fs);
end
else
disp('Not a LL or RR subject');
end
end
end
end
end
The code is running properly but I am getting 10 of:
ans =
logical
1
in the command window. This is the first time I use switch. Is that causing it? how do I fix the code so I don't get the logical answers.
Thanks!

Best Answer

else j==3
is the same as
else
disp(j==3)