0

Title says it all. Essentially, I just want to be able to get my outputs as a procedural list,

[1,0,0,1,1,1,0,0,...]

as opposed to the usual histogram. I'm still learning my way around IBM Quantum's but I would appreciate help figuring out if this can be done, and if so, how?

edit: for example, the outputs could be from something as simple as

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from numpy import pi

qreg_q = QuantumRegister(1, 'q') creg_c = ClassicalRegister(4, 'c') circuit = QuantumCircuit(qreg_q, creg_c)

circuit.h(qreg_q[0]) circuit.measure(qreg_q[0], creg_c[0]) ```

YaGoi Root
  • 57
  • 8

1 Answers1

1
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, execute
from numpy import pi

qreg_q = QuantumRegister(1, 'q')
creg_c = ClassicalRegister(4, 'c')
circuit = QuantumCircuit(qreg_q, creg_c)

circuit.h(qreg_q[0])
circuit.measure(qreg_q[0], creg_c[0])
backend = Aer.get_backend('qasm_simulator')
job = execute(circuit, Aer.get_backend('qasm_simulator'), shots=10, memory=True)

print('result for each shot:', job.result().get_memory() )


result for each shot: ['0001', '0001', '0001', '0000', '0001', '0001', '0001', '0001', '0001', '0001']
KAJ226
  • 13,822
  • 2
  • 10
  • 30