Sequence Generation of a table

1 次查看(过去 30 天)
Hassan Javed
Hassan Javed 2020-1-5
回答: Bhaskar R 2020-1-5
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.

回答(1 个)

Bhaskar R
Bhaskar R 2020-1-5
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

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by