How to solve this error "Attempt to extract field 'NormalizePathGains from 'mxArray'?

7 views (last 30 days)
How to solve this error "Attempt to extract field 'NormalizePathGains' from 'mxArray'? Here is the code
ChanRD = zeros(K,block_size*Q);
coder.extrinsic('rayleighchan');
for j = 1:K
CHANN = rayleighchan(T_s,F_D);
CHANN.NormalizePathGains = 1;
CHANN.ResetBeforeFiltering = 1;
x = ones(1,Mc_Ber*Q*block_size);% known transmitted signal
ChanRD(j,:) = filter(CHANN,x);

Answers (1)

Walter Roberson
Walter Roberson on 10 May 2016
Before the loop, assign to CHANN a structure array with the proper fields and the maximum size that rayleighchan will allocate. Then the CHANN = rayleighchan(T_s,F_D) assignment will result in the data being pulled out of the mxArray into memory accessible to the function.
  1 Comment
Hs5555
Hs5555 on 28 Oct 2018
hi walter, I've encountered the same problem in the following code:
fitresult = fit(x,y, fit_1); % fit is a function of curve fitting toolbox
slope = fitresult.a;
how do I assign the variable 'fitresult' a structure with the proper fields and the maximum size and how can i find out how much memory to allocate?

Sign in to comment.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!