Subscript indices must either be real positive integers or logicals. How to solve it?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I know this is asked very often, but still I don't know how to solve it in my case. This is the code:
M=4;
n = zeros(1,M);
q=[0:M-1]*(2/M);
for i1=1:M
for i2=1:M
n(q)=n(q)+exp(-1i*q*(i1-i2))*A(i1,i2);
end
end
I received this error message: "Subscript indices must either be real positive integers or logicals.""
Could you please help me?
Cheers!
7 Kommentare
Lorenzo Meneghetti
am 5 Dez. 2017
when you do n(q) q is zero so it gives error
arrays in matlab are accessed with indices starting from 1
also you didn't define A
Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!