Index in position 1 exceeds array bounds (must not exceed 61)
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
When I run my code I get the error Index in position 1 exceeds array bounds (must not exceed 61)
Error in neph_calibration_correction (line 9)
p=polyfit([nephzero(i,2) nephspan(i,2)],[0 11.15],1); %
What am I getting wrong here? I have gone through previous solutions but seems not working.
%% calculate neph slopes
load('neph_zero_span.mat');% nephzero nephspan
nephspan=nephspan([2:4 6:end],:);
spancoefs=zeros(length(nephspan),4).*nan;
for i=1:length(nephspan)
spancoefs(i,1)=nephspan(i,1);
p=polyfit([nephzero(i,2) nephspan(i,2)],[0 11.15],1); % red
spancoefs(i,2)=p(1);
p=polyfit([nephzero(i,3) nephspan(i,3)],[0 23.86],1); % green
spancoefs(i,3)=p(1);
p=polyfit([nephzero(i,4) nephspan(i,4)],[0 44.21],1); % blue
spancoefs(i,4)=p(1);
end
0 Commenti
Risposta accettata
KSSV
il 7 Dic 2021
This error occurs, when you try to extract more number of elements then present in the array.
A = rand(10,1) ;
A(1) % no error
A(7) % no error
A(11) % error as there is no 11th element
Check the dimensions of your variables.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!