Azzera filtri
Azzera filtri

How to convert or extract arrays from a structure?

26 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Discrete Multiresolution Analysis in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by