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.
Open the Wavelet 1-D Multisignal Analysis main tool and load the example analysis by selecting File > Example > Ex 21: Thinker (rows).
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.Type the name
decORI.After saving the decomposition data to the file
decORI.mat, load the variables into your workspace:load decORI whos
Name Size Bytes Class dec1x1163306structdec 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
caof the structuredecgives the coefficients of approximation at level 4, the fieldcdis 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 8You can change the coefficients using the
chgwdeccfsfunction.Note
For a complete description of the
decstructure, 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 |
'level'
| Level of DWT decomposition |
'wname'
| Wavelet name |
'dwtFilters' | Structure with four fields: |
'dwtEXTM'
| DWT extension mode (see |
'dwtShift'
| DWT shift parameter (0 or 1) |
'dataSize'
| Size of original matrix
|
'ca'
| Approximation coefficients at level
|
'cd'
| Cell array of detail coefficients, from 1 to
|
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:
Open the Wavelet 1-D Multisignal Analysis main tool and load the example analysis using File > Example > Ex 21: Thinker (rows).
Click the Clustering button. The Wavelet 1-D Multisignal Analysis Clustering window appears.
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.
Click the Save Curr. button.
Another dialog box appears that lets you specify a folder and filename for storing the partition data. Type the name
curPART.After saving the partition data to the file
curPART.mat, load the variables into your workspace:load curPART whos
Name Size Bytes Class tab_IdxCLU192x11536doubleYou can modify the array
tab_IdxCLUin 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.matin 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
1toNbClusters(NbClusters > 1), and each cluster must contain at least one element. The number of rows must be equal to the number of signals.