qiskit.circuit.QuantumCircuit.measure_all¶
- QuantumCircuit.measure_all(inplace=True, add_bits=True)[source]¶
Adds measurement to all qubits.
By default, adds new classical bits in a
ClassicalRegister
to store these measurements. Ifadd_bits=False
, the results of the measurements will instead be stored in the already existing classical bits, with qubitn
being measured into classical bitn
.Returns a new circuit with measurements if
inplace=False
.- Parameters
inplace (bool) – All measurements inplace or return new circuit.
add_bits (bool) – Whether to add new bits to store the results.
- Returns
Returns circuit with measurements when
inplace=False
.- Return type
- Raises
CircuitError – if
add_bits=False
but there are not enough classical bits.