How to get rid of "Error: The value of non-tunable property 'Index' does not match" when trying to choose a particular gold sequence using MATLAB function in Simulink?

4 views (last 30 days)
I am designing a system where I can flexibly choose a gold sequence using switch statement based on an index value. I am implementing this in Simulink using MATLAB function. The code I implemented is as follows:
switch PN_selector
case 0
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',-2,'SamplesPerFrame',31);
case 1
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',-1,'SamplesPerFrame',31);
case 2
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',0,'SamplesPerFrame',31);
case 3
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',1,'SamplesPerFrame',31);
case 4
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',2,'SamplesPerFrame',31);
case 5
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',3,'SamplesPerFrame',31);
case 6
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',4,'SamplesPerFrame',31);
case 7
goldseq = comm.GoldSequence('FirstPolynomial',[5 2 0], ...
'SecondPolynomial',[5 4 3 2 0], ...
'FirstInitialConditions',[0 0 0 0 1], ...
'SecondInitialConditions',[0 0 0 0 1], ...
'Index',5,'SamplesPerFrame',31);
otherwise
msg='Incorrect PNSelector received.';
error(msg);
end
As soon as I trz to run the program, I get the error The value of non-tunable property 'Index' does not match. What am I doing wrong here?

Answers (1)

Pratyush Swain
Pratyush Swain on 29 Sep 2023
Hi Prashanth,
I understand you are designing a system which uses a switch statement and you are using a matlab function block. Assuming 'PN_selector' as an input to the block,you are trying to set a block parameter during run-time.
Please refer to https://www.mathworks.com/matlabcentral/answers/776747-change-simulink-block-parameter-during-simulation article which explains the updation of parameter of an simulink block during runtime.
Hope this helps.

Categories

Find more on Simulink in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!