Hi @Daniel Chew
As I can see, the image you provided doesn’t imply your statement of counter division based on parity.
The division based on parity can be done by filling the opposite counter values with NaN. The below code, with comments explains the workflow in more detail.
% An example data (10 rows, 3 columns)
data = reshape(1:30, 10, 3); % Example: 1-30 arranged as 10x3 matrix
% Taking parity as Counter trade-off
odd_idx = 1:2:size(data,1);
even_idx = 2:2:size(data,1);
% Create tables for odd and even indexed rows
table1 = array2table(data(odd_idx,:), 'VariableNames', {'A1','A2','A3'});
table2 = array2table(data(even_idx,:), 'VariableNames', {'B1','B2','B3'});
% Prepare final table columns, initialize with NaN
nRows = size(data,1);
Index = (1:nRows)'; % Index column
A1 = nan(nRows,1); % Odd data columns
A2 = nan(nRows,1);
A3 = nan(nRows,1);
B1 = nan(nRows,1); % Even data columns
B2 = nan(nRows,1);
B3 = nan(nRows,1);
% Populate odd rows with data from table1
A1(odd_idx) = table1.A1;
A2(odd_idx) = table1.A2;
A3(odd_idx) = table1.A3;
% Populate even rows with data from table2
B1(even_idx) = table2.B1;
B2(even_idx) = table2.B2;
B3(even_idx) = table2.B3;
% Merge all the columns to a table
resultTable = table(Index, A1, A2, A3, B1, B2, B3);
%Display
disp(resultTable);
Hope this helps!