Hi @Amy Hs
If you have m hot streams and n cold streams, and you want to list all possible ways each hot stream can face the cold streams in any order, you can use permutations. For example, with 2 hot (h1, h2) and 2 cold (c1, c2) streams, here’s a simple MATLAB code to generate all possible cases:
m = 2; % number of hot streams
n = 2; % number of cold streams
cold_perms = perms(1:n); % all possible orders for cold streams
num_cases = size(cold_perms, 1)^m;
cases = zeros(m, n, num_cases);
counter = 1;
for i = 1:size(cold_perms,1)
for j = 1:size(cold_perms,1)
cases(:,:,counter) = [cold_perms(i,:); cold_perms(j,:)];
counter = counter + 1;
end
end
% Display all cases
for k = 1:size(cases,3)
fprintf('Case %d:\n', k);
for h = 1:m
fprintf(' h%d vs c%d then h%d vs c%d\n', h, cases(h,1,k), h, cases(h,2,k));
end
end
For more information, Please refer the following MathWorks documentation link:
Hope this helps!