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