How to obtain the boolean expression from a 4 input K-Map - boolean

I noticed the 4 input K-map is read differently from a 3 input K-map.
I am assuming the A, not A, B, not B, C , not C , D and not D are located differently in a 4 input K-Map.
Can anyone explain where these locations are located on a 4 input K map?

There is article about Karnaugh map in Wikipedia. This is layout of map for 4 variables:
K-map for 4 variables.

Related

Merge lines from a text file into another text file at specific points

I have two separate text files; question.txt and answers.txt.
I would like to pull in the answers from the answer file into the question file, as shown below
BEFORE:
Question file contents:
How many sides does a triangle have?
A. 1
B. 2
C. 3
D. 4
Answer:
How many sides does a square have?
A. 1
B. 2
C. 3
D. 4
Answer:
Answer file contents:
C.
D.
AFTER:
Question file:
How many sides does a triangle have?
A. 1
B. 2
C. 3
D. 4
Answer: C
How many sides does a square have?
A. 1
B. 2
C. 3
D. 4
Answer: D

How to add 2 Attributes one after another in MSTR?

I am new to MSTR and trying to build a new Dossier and i got stuck on the below issue.
I have 2 attributes and 1 metric in my dataset and Attribute 1 has data A, B & C and Attribute 2 has data X, Y, Z. i want dashboard to look like this
Attribute Metric
A 1
B 2
C 3
X 4
Y 5
Z 6
When i create my result look like below.
Attribute1 Attribute2 Metric
A X 1
B y 2
C z 3
Please help.
Can you reformat your results - Attribute Metric A 1 B 2 C 3 X 4 Y 5 Z 6
I think you mean you want to view metrics for the elements for both the attributes appended one below the other.
I'd suggest you create a consolidation / custom group object and add all elements from both your attributes.
And use this consolidation / custom group instead of the attribute on your report.

What to call (1 by n) plus (n by 1) operation?

I stumbled across an unexpected behavior of the addition operator.
a=[1 2 3];
b=[5; 7; 11];
a+b
Produces
ans =
6 7 8 % a(1)+b(1) a(1)+b(2) a(1)+b(3)
8 9 10 % a(2)+b(1) a(2)+b(2) a(2)+b(3)
12 13 14 % a(3)+b(1) a(3)+b(2) a(3)+b(3)
This behavior probably falls under the Add a Vector to a Matrix example in the documentation.
Create an array, A, and add a column vector to it. The vector is
treated as though it is a matrix of the same size as A, so that each
element in the vector is added to a row in A.
Although, b in my example cannot be treated as the same size as a. Both vectors must be duplicated.
What can I call this behavior when I am describing it to others? None of the definitions of Matrix Addition fit. Vector addition also has a different definition. The best I could come up with was the "sum of the elements in the cartesian product".
That's called binary singleton expansion. Starting with R2016b, MATLAB does it automatically with standard operators. See bsxfun for more details.

How to generate all possible combinations of K instances of N objects in Matlab? [duplicate]

This question already has answers here:
Generate a matrix containing all combinations of elements taken from n vectors
(4 answers)
Closed 8 years ago.
How to generate all possible combinations of K instances of N objects in Matlab?
For example, if we have N=3 objects A, B and C, and wish to generate combinations of K=2 instances, we should get
AA
AB
AC
BA
BB
BC
CA
CB
CC
I.e. this is how figures in a number combinate.
You can use fullfact:
fullfact([3 3])
This will produce all the combinations of 3 elements in the first row and 3 elements in the second row, resulting with:
1 1
2 1
3 1
1 2
2 2
3 2
1 3
2 3
3 3
Using allcomb from matlab file exchange:
allcomb(['A','B','C'],['A','B','C'])
download
A more generalized method:
s='A':'D'
k=3
e=repmat({s},1,k)
allcomb(e{:})

Power to elements in a matrix

I have a question about being able to bring some number to the power of an element in a matrix.
I know that, if A is a matrix, then one could write A.^2 to take the square of each number in that matrix. My question is, is there any way to something like: B=2.^A, such that the resulting matrix B is the same size as A, and each element in that matrix is equal to 2 to the power of the corresponding element in A?
Thanks for any help!
You already answered yourself! Use B = 2.^A.
For example:
>> A = [1 2; 3 4]
A =
1 2
3 4
>> B = 2.^A
B =
2 4
8 16
You could also use power(2,A), which is the same thing.
Matlab is a very interactive platform, so feel free to experiment and see for yourself if something works or not. In this case your intuition was correct.