# querystates

**Installation Required:** This functionality requires MATLAB Support Package for Quantum Computing.

## Syntax

## Description

`[`

returns the possible states and the probability of measuring each state from the specified
quantum state or measurement. The input `states`

,`probabilities`

] = querystates(`s`

)`s`

must be a
`QuantumState`

or `QuantumMeasurement`

object.

If

`s`

is a`QuantumState`

object, then`querystates`

returns each possible state and the probability of measuring that state.If

`s`

is a`QuantumMeasurement`

object, then`querystates`

returns each measured state and the estimated probability of that state.

`[`

specifies a set of qubits for which to find possible states and the probabilities of those
states.`states`

,`probabilities`

] = querystates(`s`

,`qubits`

)

`[`

specifies options using one or more name-value arguments in addition to any of the input
argument combinations in previous syntaxes. For example, you can choose the basis in which
each qubit is represented or a probability threshold to include states in the output.`states`

,`probabilities`

] = querystates(___,`Name=Value`

)

## Examples

## Input Arguments

## Output Arguments

## Tips

To plot a histogram of possible states and their probabilities, you can use

`histogram`

. The`histogram`

function (with no output argument) has the same syntaxes as`querystates`

.

## Version History

**Introduced in R2023a**