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

2 vues (au cours des 30 derniers jours)
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));

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by