필터 지우기
필터 지우기

How to convert or extract arrays from a structure?

조회 수: 26 (최근 30일)
FW
FW 2019년 10월 25일
편집: Matt J 2019년 10월 25일
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.

채택된 답변

Matt J
Matt J 2019년 10월 25일
편집: Matt J 2019년 10월 25일
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
FW
FW 2019년 10월 25일
Thanks it works. What is the function of the dot here [Structure name] dot [Array name]?
Matt J
Matt J 2019년 10월 25일
편집: Matt J 2019년 10월 25일
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,

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by