# reorderBinarySensorData

Reorder data from a binary sensor mask.

## Syntax

    data = reorderBinarySensorData(data, reorder_index)

## Description

`reorderBinarySensorData` reorders sensor data returned by the k-Wave simulation functions (e.g., `kspaceFirstOrder2D` and `kspaceFirstOrder3D`) according to a given reordering index. This is useful when using a binary sensor mask in place of a Cartesian sensor mask with nearest neighbour interpolation (Cartesian sensor masks are not supported by the C++ codes).

Example syntax (assuming `sensor.record` is not defined)

    % convert Cartesian sensor mask to binary sensor mask
    [sensor.mask, ~, reorder_index] = cart2grid(kgrid, sensor.mask);

    % run simulation
    sensor_data = kspaceFirstOrder3DC(kgrid, medium, source, sensor)

    % reorder output to order used in Cartesian sensor mask
    sensor_data = reorderBinarySensorData(sensor_data, reorder_index);

If recording multiple outputs, then pass the individual outputs (e.g., `sensor_data.ux`) to `reorderBinarySensorData`.

## Inputs

`data` | sensor data returned by the k-Wave simulation functions indexed as `(sensor_point_index, time_index)`
`reorder_index` | order of the Cartesian sensor points in the binary mask (this is returned by `cart2grid`)

## Outputs

`data` | reordered data according to the order of the sensor points defined in the original Cartesian sensor mask

## See Also

`reorderSensorData`, `unmaskSensorData`