Sequence Generation of a table

11 vues (au cours des 30 derniers jours)
Hassan Javed
Hassan Javed le 5 Jan 2020
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.

Réponses (1)

Bhaskar R
Bhaskar R le 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

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by