Index in position 1 is invalid. Array indices must be positive integers or logical value.
2 views (last 30 days)
Show older comments
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 Comments
Ameer Hamza
on 18 Apr 2020
If you are trying to extract the column, then you should write it like this
pctCollapseThenChimeraArr = 100*mean(StateTransitionResults(: ,1) );
Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!