Sequence Generation of a table
6 views (last 30 days)
Show older comments
Hi, I am trying to made a code to generate a sequence like the one in picture but am not really good at Matlab code as much as C++ (using loops and iterations) but I cant use the same logic here. Would be thankful to you if you can help me with a code to generate output like the one in picture.

0 Comments
Answers (1)
Bhaskar R
on 5 Jan 2020
First 4 columns follows truth table notation values and next two columns are one,
n = 4; % truth table size
header = {'PL100', 'CY103', 'CY104','CY105', 'CY107', 'CY108'}; % header of table
truth_table = fliplr(fullfact(ones(1, n) + 1)); % your truth table
truth_table(:, end+1:end+2) = 1; % append ones to next two columns
table_values = truth_table + repmat(10* [1:size(truth_table, 2)], 2^n,1); % construct values table
tb = strcat('seq', cellfun(@num2str,num2cell(table_values), 'UniformOutput', false)); % append char 'seq' by converting to char type
tb = [header; tb]; % append header
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!