Index in position 1 is invalid. Array indices must be positive integers or logical value.

조회 수: 1 (최근 30일)
I am having a problem with my index variable, and I don't know why the issue is happening.
for ii = 1: length(omegaDArr) % omega_D iterated
omegaD = omegaDArr(ii);
epsilon = epsilonArr(jj);
Iter = 1;
driverCollapseOccurrenceArray = zeros(1, Iter);
StateTransitionResults = zeros(Iter, 2);
for kk = 1 : Iter
xD = rand(N,1)*2*pi; % Init Cond. Driver
xR1 = rand(N,1)*2*pi; % Init. Cond. Resp1
xR2 = rand(N,1)*2*pi; % init. Cond. Resp2
[X, outcome, networkCollapsedFlags, timesChimeraToCollapsed,timesCollapsedToChimera]=changesN_TestChaosMain(kk, N, b, alphaD, omegaD, couplingonset, epsilon, xD, xR1, xR2, NumberWindows, WindowLength, dt);
driverCollapseOccurrenceArray(kk) = networkCollapsedFlags(1); % driver
StateTransitionResults(kk,1) = ~isempty(timesChimeraToCollapsed);
StateTransitionResults(kk,2) = ~isempty(timesCollapsedToChimera);
end
this line:
pctCollapseThenChimeraArr = 100*mean(StateTransitionResults(StateTransitionResults(:,2) ,1) );
gives the error message:
Index in position 1 is invalid. Array indices must be positive integers or logical values.
  댓글 수: 6
Ameer Hamza
Ameer Hamza 2020년 4월 18일
If you are trying to extract the column, then you should write it like this
pctCollapseThenChimeraArr = 100*mean(StateTransitionResults(: ,1) );

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by