read
Read values of WPTREE
Description
returns the value of the wavelet packet tree value
= read(T
,propname
,propparam
)T
property
specified by propname
. propparam
is an
optional parameter depending on the value of propname
.
You can specify one or more properties in any order.
arguments must appear after other arguments. For example,
propname
-propparam
[value1,value2,value3,value4] =
read(T,
.propname
1,propname
2,propname
3,propparam
3,propname
4,propparam
4)
Examples
Create a wavelet packet tree.
x = rand(1,512);
t = wpdec(x,3,"db3");
t = wpjoin(t,[4;5]);
Display the tree.
plot(t)
Obtain the size of the data at every node in ascending node index order.
sAll = read(t,"sizes")
sAll = 11×2
1 512
1 258
1 258
1 131
1 131
1 131
1 131
1 68
1 68
1 68
1 68
⋮
Obtain the size of the data at nodes of indices 0
, 4
and 5
.
sNod = read(t,"sizes",[0,4,5])
sNod = 3×2
1 512
1 131
1 131
Obtain the entropy of all the nodes.
eAll = read(t,"ent")
eAll = 11×1
116.3597
45.9147
39.1646
-30.2074
17.6607
20.8560
18.8364
-114.8913
11.4664
9.2578
9.0248
⋮
Obtain the entropy at nodes of indices 0
, 4
and 5
.
eNod = read(t,"ent",[0,4,5])
eNod = 3×1
116.3597
17.6607
20.8560
Obtain the wavelet filters and wavelet coefficients.
[loD,hiD,loR,hiR] = read(t,"wfilters"); [loD1,loR1,hiD1,hiR1] = read(t,"wfilters","l","wfilters","h"); [max(abs(loD-loD1)) max(abs(hiD-hiD1)) ... max(abs(loR-loR1)) max(abs(hiR-hiR1))]
ans = 1×4
0 0 0 0
Obtain the wavelet coefficients at all nodes.
dAll = read(t,"data");
Obtain the wavelet coefficients at nodes of indices 4
and 5
.
dNod = read(t,"data",[4;5]); [ent,cfs4,cfs5] = read(t,"ent","cfs",4,"cfs",5); [max(abs(dNod{1}-cfs4)) max(abs(dNod{2}-cfs5))]
ans = 1×2
0 0
Plot the coefficients at node index 4
.
plot(cfs4)
title("Node 4 Wavelet Coefficients")
Input Arguments
Wavelet packet tree, specified as a WPTREE
object.
Wavelet packet tree property name, specified as one of the following:
Property Name
( | Property Parameter
( |
---|---|
"ent" , "ento"
or "sizes" (see wptree ) | Without |
"cfs" | With |
"entName" ,
"entPar" , "wavName"
(see wptree ) or
"allcfs" | Without |
"wfilters" (see wfilters ) | Without |
"data" | Without |
Example: [value1,value2,value3,value4] =
read(T,"wavName","allcfs","cfs",4,"wfilters","h")
Parameter associated with the property propname
,
specified as an integer or vector of integers.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)