How to convert or extract arrays from a structure?

43 visualizaciones (últimos 30 días)
FW
FW el 25 de Oct. de 2019
Editada: Matt J el 25 de Oct. de 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.

Respuesta aceptada

Matt J
Matt J el 25 de Oct. de 2019
Editada: Matt J el 25 de Oct. de 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 comentarios
FW
FW el 25 de Oct. de 2019
Thanks it works. What is the function of the dot here [Structure name] dot [Array name]?
Matt J
Matt J el 25 de Oct. de 2019
Editada: Matt J el 25 de Oct. de 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,

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Discrete Multiresolution Analysis en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by