Main Content

Importing and Exporting Multisignal Information from the Wavelet Analyzer App

The Wavelet 1-D Multisignal Analysis tool lets you move data to and from disk.

Saving Information to Disk

You can save decompositions and denoised or compressed signals (including the corresponding decompositions from Wavelet 1-D Multisignal Analysis tools) to disk. You then can manipulate the data and later import it again into the graphical tools.

Saving Decompositions

The Wavelet 1-D Multisignal Analysis main tool lets you save the entire set of data from a wavelet analysis to disk. The toolbox creates a MAT-file in the current folder with a name you choose.

  1. Open the Wavelet 1-D Multisignal Analysis main tool and load the example analysis by selecting File > Example > Ex 21: Thinker (rows).

  2. Save the data from this analysis, using the menu option File > Save Decompositions.

    A dialog box appears that lets you specify a folder and filename for storing the decomposition data. For this example, use the name decORI.mat.

  3. Type the name decORI.

  4. After saving the decomposition data to the file decORI.mat, load the variables into your workspace:

    load decORI 
    whos
    
    NameSizeBytesClass
    dec1x1163306struct
    dec
    dec =
             dirDec: 'r'
              level: 4
              wname: 'db2'
         dwtFilters: [1x1 struct]
            dwtEXTM: 'sym'
           dwtShift: 0
           dataSize: [192 96]
                 ca: [192x8 double]
                 cd: {1x4 cell}
    

    The field ca of the structure dec gives the coefficients of approximation at level 4, the field cd is a cell array which contains the coefficients of details.

    size(dec.cd{1})
    ans = 
       192    49 
    size(dec.cd{2})
    ans = 
       192    26 
    size(dec.cd{3})
    ans = 
       192    14 
    size(dec.cd{4})
    ans = 
       192     8
    

    You can change the coefficients using the chgwdeccfs function.

    Note

    For a complete description of the dec structure, see Loading Decompositions.

Loading Information into the Wavelet 1-D Multisignal Analysis Tool

You can load signals or decompositions into the graphical interface. The information you load may be previously exported from the graphical interface, and then manipulated in the workspace; or it may be information you initially generated from the command line. In either case, you must observe the strict file formats and data structures used by the Wavelet 1-D Multisignal Analysis tools or errors will occur when you try to load information.

Loading Signals

To load a signal you constructed in your MATLAB® workspace into the Wavelet 1-D Multisignal Analysis tool, save the signal in a MAT-file (with extension .mat).

For example, if you design a signal called magic128 and want to analyze it in the Wavelet 1-D Multisignal Analysis tool, type

save magic128 magic128

Note

The workspace variable magic128 must be a matrix and the number of rows and columns must be greater than 1.

sizmag = size(magic128)

sizmag =
    128   128

To load this signal into the Wavelet 1-D Multisignal Analysis tool, use the File > Load Signal menu item. A dialog box appears in which you select the appropriate MAT-file to be loaded.

Note

When you load a matrix of signals from the disk, the name of 2-D variables are inspected in the following order: x, X, sigDATA, and signals. Then, the 2-D variables encountered in the file are inspected in alphabetical order.

Loading Decompositions

To load decompositions that you constructed in the MATLAB workspace into the Wavelet 1-D Multisignal Analysis tool, save the signal in a MAT-file (with extension mat).

For instance, if you design a signal called magic128 and want to analyze it in the Wavelet 1-D Multisignal Analysis too, the structure dec must have the following fields:

'dirDec'

Direction indicator with 'r' for row or 'c' for column

'level'

Level of DWT decomposition

'wname'

Wavelet name

'dwtFilters'

Structure with four fields: LoD, HiD, LoR, HiR

'dwtEXTM'

DWT extension mode (see dwtmode)

'dwtShift'

DWT shift parameter (0 or 1)

'dataSize'

Size of original matrix X

'ca'

Approximation coefficients at level dec.level

'cd'

Cell array of detail coefficients, from 1 to dec.level

The coefficients cA and cD{k}, for (k = 1 to dec.level), are matrices and are stored row-wise if dec.dirDec is equal to 'r' or column-wise if dec.dirDec is equal to 'c'.

Note

The fields 'wname' and 'dwtFilters' have to be compatible (see the wfilters function). The sizes of cA and cD{k}, (for k = 1 to dec.level) must be compatible with the direction, the level of the decomposition, and the extension mode.

Loading and Saving Partitions.

Loading

The Wavelet 1-D Multisignal Analysis main tool and clustering tool let you load a set of partitions from disk.

Saving Partitions

The Wavelet 1-D Multisignal Analysis clustering tool lets you save a set of partitions to disk.

For example:

  1. Open the Wavelet 1-D Multisignal Analysis main tool and load the example analysis using File > Example > Ex 21: Thinker (rows).

  2. Click the Clustering button. The Wavelet 1-D Multisignal Analysis Clustering window appears.

  3. Click the Compute Clusters button, and then save the current partition using menu option File > Partitions > Save Current Partition. A dialog box appears that lets you specify the type of data to save.

  4. Click the Save Curr. button.

  5. Another dialog box appears that lets you specify a folder and filename for storing the partition data. Type the name curPART.

  6. After saving the partition data to the file curPART.mat, load the variables into your workspace:

    load curPART
    whos
    
    NameSizeBytesClass
    tab_IdxCLU192x11536double
  7. You can modify the array tab_IdxCLU in the workspace, and save the partition data in a file. For example to create two new partitions with four and two clusters, type the following lines:

    tab_IdxCLU(:,2) = rem((1:192)',4) + 1; 
    tab_IdxCLU(:,3) = double((1:192)'>96) + 1; 
    save newpart tab_IdxCLU
    

    Now you can use three partitions for the example Ex 21: Thinker (rows). Then, you can load the partitions stored in the file newPART.mat in the Wavelet 1-D Multisignal Analysis main tool and clustering tool.

    Note

    A partition is a column vector of integers. The values must vary from 1 to NbClusters (NbClusters > 1), and each cluster must contain at least one element. The number of rows must be equal to the number of signals.