| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Wavelet Toolbox |
| Contents | Index |
Importing and Exporting from Graphical Tools
The Wavelet Packet 1-D and Wavelet Packet 2-D tools let you import information from and export information to your disk.
If you adhere to the proper file formats, you can
Saving Information to Disk
Using specific file formats, the graphical tools let you save synthesized signals or images, as well as one- or two-dimensional wavelet packet decomposition structures. This feature provides flexibility and allows you to combine command line and graphical interface operations.
Saving Synthesized Signals
You can process a signal in the Wavelet Packet 1-D tool, and then save the processed signal to a MAT-file.
For example, load the example analysis:
File
Example Analysis
db1 - depth: 2 - ent: shannon --> sumsin
and perform a compression or de-noising operation on the original signal. When you close the Wavelet Packet 1-D De-noising or Wavelet Packet 1-D Compression window, update the synthesized signal by clicking Yes in the dialog box.
Then, from the Wavelet Packet 1-D tool, select the File
Save
Synthesized Signal menu option.
A dialog box appears allowing you to select a directory and filename for the MAT-file. For this example, choose the name synthsig.
To load the signal into your workspace, simply type
load synthsig whos
| Name |
Size |
Bytes |
Class |
| synthsig |
1x1000 |
8000 |
double array |
| valTHR |
1x1 |
8 |
double array |
| wname |
1x3 |
6 |
char array |
The synthesized signal is given by synthsig. In addition, the parameters of the de-noising or compression process are given by the wavelet name (wname) and the global threshold (valTHR).
Saving Synthesized Images
You can process an image in the Wavelet Packet 2-D tool, and then save the processed image to a MAT-file (with extension mat or other).
For example, load the example analysis:
File
Example Analysis
db1 - depth: 1 - ent: shannon --> woman
and perform a compression on the original image. When you close the Wavelet Packet 2-D Compression window, update the synthesized image by clicking Yes in the dialog box that appears.
Then, from the Wavelet 2-D tool, select the File
Save
Synthesized Image menu option.
A dialog box appears allowing you to select a directory and filename for the MAT-file. For this example, choose the name wpsymage.
To load the image into your workspace, simply type
load wpsymage whos
| Name |
Size |
Bytes |
Class |
| X |
256x256 |
524288 |
double array |
| map |
255x3 |
6120 |
double array |
| valTHR |
1x1 |
8 |
double array |
| wname |
1x3 |
6 |
char array |
The synthesized image is given by X. The variable map contains the associated colormap. In addition, the parameters of the de-noising or compression process are given by the wavelet name (wname) and the global threshold (valTHR).
Saving One-Dimensional Decomposition Structures
The Wavelet Packet 1-D tool lets you save an entire wavelet packet decomposition tree and related data to your disk. The toolbox creates a MAT-file in the current directory with a name you choose, followed by the extension wp1 (wavelet packet 1-D).
Open the Wavelet Packet 1-D tool and load the example analysis:
File
Example Analysis
db1 - depth: 2 - ent: shannon --> sumsin
To save the data from this analysis, use the menu option File
Save Decomposition.
A dialog box appears that lets you specify a directory and file name for storing the decomposition data. Type the name wpdecex1d.
After saving the decomposition data to the file wpdecex1d.wp1, load the variables into your workspace.
load wpdecex1d.wp1 -mat whos
| Name |
Size |
Bytes |
Class |
| data_name |
1x6 |
12 |
char array |
| tree_struct |
1x1 |
11176 |
wptree object |
| valTHR |
0x0 |
0 |
double array |
The variable tree_struct contains the wavelet packet tree structure. The variable data_name contains the data name and valTHR contains the global threshold, which is currently empty since the synthesized signal does not exist.
Saving Two-Dimensional Decomposition Structures
The file format, variables, and conventions are exactly the same as in the one-dimensional case except for the extension, which is wp2 (wavelet packet 2-D). The variables saved are the same as with the one-dimensional case, with the addition of the colormap matrix map:
| Name |
Size |
Bytes |
Class |
| data_name |
1x5 |
10 |
char array |
| map |
255x3 |
6120 |
double array |
| tree_struct |
1x1 |
527400 |
wptree object |
| valTHR |
1x1 |
8 |
double array |
Save options are also available when performing de-noising or compression inside the Wavelet Packet 1-D and Wavelet Packet 2-D tools.
In the Wavelet Packet De-Noising windows, you can save the de-noised signal or image and the decomposition. The same holds true for the Wavelet Packet Compression windows.
This way, you can save directly many different trials from inside the De-Noising and Compression windows without going back to the main Wavelet Packet windows during a fine-tuning process.
| Note When saving a synthesized signal (1-D), a synthesized image (2-D) or a decomposition to a MAT-file, the extension of this file is free. The mat extension is not necessary. |
Loading Information into the Graphical Tools
You can load signals, images, or one- and two-dimensional wavelet packet decompositions into the graphical interface tools. The information you load may have been previously exported from the graphical interface, and then manipulated in the workspace, or it may have been information you generated initially from the command line.
In either case, you must observe the strict file formats and data structures used by the graphical tools, or else errors will result when you try to load information.
Loading Signals
To load a signal you've constructed in your MATLAB® workspace into the Wavelet Packet 1-D tool, save the signal in a MAT-file (with extension mat or other).
For instance, suppose you've designed a signal called warma and want to analyze it in the Wavelet Packet 1-D tool.
The workspace variable warma must be a vector.
To load this signal into the Wavelet Packet 1-D tool, use the menu option File
Load Signal.
A dialog box appears that lets you select the appropriate MAT-file to be loaded.
| Note The first one-dimensional variable encountered in the file is considered the signal. Variables are inspected in alphabetical order. |
Loading Images
This toolbox supports only indexed images. An indexed image is a matrix containing only integers from 1 to n, where n is the number of colors in the image.
This image may optionally be accompanied by a n-by-3 matrix called map. This is the colormap associated with the image. When MATLAB displays such an image, it uses the values of the matrix to look up the desired color in this colormap. If the colormap is not given, the Wavelet Packet 2-D graphical tool uses a monotonic colormap with max(max(X))-min(min(X))+1 colors.
To load an image you've constructed in your MATLAB workspace into the Wavelet Packet 2-D tool, save the image (and optionally, the variable map) in a MAT-file (with extension mat or other).
For instance, suppose you've created an image called brain and want to analyze it in the Wavelet Packet 2-D tool. Type
To load this image into the Wavelet Packet 2-D tool, use the menu option File
Load Image.
A dialog box appears that lets you select the appropriate MAT-file to be loaded.
| Note The first two-dimensional variable encountered in the file (except the variable map, which is reserved for the colormap) is considered the image. Variables are inspected in alphabetical order. |
Caution The graphical tools allow you to load an image that does not contain integers from 1 to n. The computations will be correct since they act directly on the matrix, but the display of the image will be strange. The values less than 1 will be evaluated as 1, the values greater than n will be evaluated as n, and a real value within the interval [1,n] will be evaluated as the closest integer.
Note that the coefficients, approximations, and details produced by wavelet packets decomposition are not indexed image matrices. To display these images in a suitable way, the Wavelet Packet 2-D tool follows these rules:
Loading Wavelet Packet Decomposition Structures
You can load one- and two-dimensional wavelet packet decompositions into the graphical tools providing you have previously saved the decomposition data in a MAT-file of the appropriate format.
While it is possible to edit data originally created using the graphical tools and then exported, you must be careful about doing so. Wavelet packet data structures are complex, and the graphical tools do not do any consistency checking. This can lead to errors if you try to load improperly formatted data.
One-dimensional data file contains the following variables:
These variables must be saved in a MAT-file (with extension wp1 or other).
Two-dimensional data file contains the following variables:
These variables must be saved in a MAT-file (with extension wp2 or other).
To load the properly formatted data, use the menu option File
Load Decomposition Structure from the appropriate tool, and then select the desired MAT-file from the dialog box that appears.
The Wavelet Packet 1-D or 2-D graphical tool then automatically updates its display to show the new analysis.
| Note When loading a signal (1-D), an image (2-D), or a decomposition (1-D or 2-D) from a MAT-file, the extension of this file is free. The mat extension is not necessary. |
| Provide feedback about this page |
![]() | Two-Dimensional Wavelet Packet Analysis | Advanced Concepts | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |