Filter löschen
Filter löschen

How to convert or extract arrays from a structure?

26 Ansichten (letzte 30 Tage)
FW
FW am 25 Okt. 2019
Bearbeitet: Matt J am 25 Okt. 2019
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.

Akzeptierte Antwort

Matt J
Matt J am 25 Okt. 2019
Bearbeitet: Matt J am 25 Okt. 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 Kommentare
FW
FW am 25 Okt. 2019
Thanks it works. What is the function of the dot here [Structure name] dot [Array name]?
Matt J
Matt J am 25 Okt. 2019
Bearbeitet: Matt J am 25 Okt. 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,

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Discrete Multiresolution Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by