MATLAB: I want to create an array as 1_1, 1_2, 1_3, 1_4, 2_1,2_2, 2_3, 2_4 ………2​4_1,24_2,2​4_3,24_4..​….help me out please

matlab array with iterative code

need a loop code for creating the array needed as mentioned above

Best Answer

allCells = [];
for loop1=1:24
for loop2=1:4
sThisElement = [num2str(loop1), '_', num2str(loop2)];
allCells = [allCells, {sThisElement}];
end
end
disp(allCells);