필터 지우기
필터 지우기

I got to see a lot of matlab code where the following types of initialization were used like param.L and so on ....why cant we just use L ?

조회 수: 1 (최근 30일)
param.L = 3; % number of elements in each linear combination.
param.K = 50; % number of dictionary elements
param.numIteration = 50; % number of iteration to execute the K-SVD algorithm.
N = 1500; % number of signals to generate
n = 20; % dimension of each data
SNRdB = 20; % level of noise to be added
[param.TrueDictionary, D, x] = generateSyntheticDictionaryAndData(N, param.L, n, param.K, SNRdB);

채택된 답변

Birdman
Birdman 2017년 11월 1일
In this context, param refers to a struct and L and K represents its fields. By this way, it is easier to maintain the variables. Fields can have different type of datas. For instance, you can define yourself as a struct, and your properties like height, weight, hair color, name, surname, ... as its fields.
  댓글 수: 2
Stephen23
Stephen23 2017년 11월 1일
편집: Stephen23 2017년 11월 1일
Moreover, using a struct is a really simple and neat way to hold lots of parameter values, and pass them to any functions as required: this is because a struct is convenient and simple to handle (just one variable), but allow clearly identifiable fieldnames for each parameter. You should use structs.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by