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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by