How to solve an error "exceeds the number of array elements" in a two block experiment with different lengths.

1 view (last 30 days)
I am trying to get this to play two blocks. the first block would have ten sentences at one SNR. the second block would have 60 sentences (30*2 SNRs) at two SNRs. However, I am getting the following error and do not know how to solve it. Any help is appreciated
Index exceeds the number of array elements (1).
Error in SINtest (line 112)
expData.SNROrder(:,1) = SNR_PRAC(randomCond(numSNRs,numREPS));
SNR = [3 8]; %the two SNR conditions
SNR_PRAC= 8; %the only SNR condition I want played in the practice block
NUM_SENT_COND = 30; %the number of sentences per SNR condition for the second block
NUM_SENT_BLOCK_PRAC = 10; %the number of sentences for the first practice block
numSNRs = length(SNR);
numSNRs_PRAC=length(SNR_PRAC);
numREPS = NUM_SENT_COND;
numREPS_PRAC =NUM_SENT_BLOCK_PRAC;
expData.SNROrder(:,1) = SNR_PRAC(randomCond(numSNRs,numREPS)); %HERE IS THE ERROR.
expData.SNROrder(:,2) = SNR(randomCond(numSNRs,numREPS));

Accepted Answer

Alyssa Davidson
Alyssa Davidson on 22 Oct 2020
Problem solved.
SNR_PRAC needed to be the same size matrix as SNR so it was fixed by [8 8].

More Answers (0)

Community Treasure Hunt

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

Start Hunting!