# CIBC:Documentation:SCIRun:Reference:SCIRun:SwapFieldDataWithMatrixEntries

## Contents

**SwapFieldDataWithMatrixEntries**

### Information

- Package: SCIRun
- Category: ChangeFieldData
- Author(s): Michael Callahan
- Status: Supported in latest version
- Version:
**3.0**

### Description

#### Summary

Add and remove data from a field.

#### Detailed Description

This module performs two simultaneous operations.

First the **Input Field** is split into its mesh part and its data values. The data values are packaged up and passed to the **Output Matrix** port.

Second the input field geometry is joined with the data from the **Input Matrix**, and the result is passed out on the **Output Field** port. If the input matrix is not present, then the second operation is not performed and the Output Field is the same as the Input Field.

The format of the **Output Matrix** will be a column matrix if the input field was of scalar type. It will be an Nx3 matrix if the input field contained vectors. If the field contained tensors it will be Nx9 matrix, where the tensor is flattened out in left to right, top to bottom order. Column 0 contains (0, 0), column 1 contains (0, 1), column 2 contains (0,2), column 3 contains (1, 0), etc.

The **Input Matrix** should have the same number of values as the field where the values are to be stored. The type of the Intput Field is preserved in the Output field as well. So for instance if the input field is a vector field, the Output Field will also be a vector field, and the input matrix should be an Nx3 matrix where N is equal to the number of elements to be filled in.

### Frequently Asked Questions

### Known Bugs

### Recent Changes

#### Feb 11, 2004

The module now will try to preserve the scalar type of the field, so if you pass it in a TetVolField of integers and a row matrix, it will return a TetVolField of integers. If the types are not convertible then you will still get a default Vector,Tensor, or double field as appropriate. If you need the old behavior use ConvertFieldDataType to convert the input field to double type before passing it in.

Go back to Documentation:SCIRun:Reference:SCIRun