How to convert or extract arrays from a structure?

41 views (last 30 days)
In continuous wavelet analysis, when we export the coefficients into the workspace, the data is exported as a structure (1x1 struct). It has three fields as follows with their values:
coefs 32 x 9957
scales 1x32
wname 'gaus1'
Can we get the coefs as an array? I tried struct2cell(S) but there was an error.
Thanks.

Accepted Answer

Matt J
Matt J on 25 Oct 2019
Edited: Matt J on 25 Oct 2019
S.coefs already is an array. If you mean that you want it in a separate non-struct variable, simply assign it to something,
coefficients=S.coefs;
  2 Comments
FW
FW on 25 Oct 2019
Thanks it works. What is the function of the dot here [Structure name] dot [Array name]?
Matt J
Matt J on 25 Oct 2019
Edited: Matt J on 25 Oct 2019
Doing this lets you access a field of a structure as if it were any other variable. For instance, this,
a=S.coefs(2,3);
is equivalent to,
c=S.coeffs;
a=c(2,3);
See also,

Sign in to comment.

More Answers (0)

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!