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

2 次查看(过去 30 天)
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));

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by