folder = dir('12LPS_G_Fr5.42_X=0_Y=*');
n = length(folder);
Y = [0;10;15;20;25;30;35;5];
all_LT_C = cell(n, 1);
all_TT_C = cell(n, 1);
all_z = zeros(n,n);
for i=1:n
loaded = load(folder(i).name);
LT = logical(loaded.voltageA>2.5);
%Converting Leading Tip to Binary
TT = logical(loaded.voltageB>2.5);
%Converting Trailing Tip to Binary
LT_C = mean(LT);
%Void Fraction Leading Tip
TT_C = mean(TT);
%Void Fraction Trailing Tip
z = [];
for i = 1:n
z = [z i+rand];
end
all_LT_C{i} = LT_C;
all_TT_C{i} = TT_C;
all_z(i,:) = z;
end
I do not assume here that voltageA or voltageB are vectors, so I do not assume that taking the mean() will give a scalar, or that it will give the same size each time.
You really should be more careful on the mean, as it operates along the first non-singular dimension. If your voltageA was 3 x 1 one time it would give 1 x 1 (okay), and if it were 3 x 2 it would give 1 x 2 (okay), but if it were 1 x 3 then it would give 1 x 1 -- so you cannot predict the number of columns of the result just looking at the number of columns of the input.