Why do I get "Array indices must be positive integers or logical values" error when using "angle" function?
2.298 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 26 de Mzo. de 2018
Movida: Walter Roberson
el 20 de Ag. de 2022
Why do I get "Array indices must be positive integers or logical values" error when using "angle" function?
>> z = 22+i
>> a = angle(z)
>> z =
22.0000 + 1.0000i
ERROR: Array indices must be positive integers or logical values.
Respuesta aceptada
MathWorks Support Team
el 22 de Ag. de 2023
Editada: MathWorks Support Team
el 20 de Mayo de 2021
Based on the error message, it seems like you have a variable with the name "angle" stored in your workspace that overshadows the "angle" function
4 comentarios
Walter Roberson
el 28 de Abr. de 2022
That code assumes that the values in Scores and Scores2 are all positive integers, and will give you an error if that is not the case.
That code also assumes that the Scores and Scores2 values are all either 1 or 2, but will not give an error if they are larger integers instead.
DGM
el 10 de Mayo de 2022
Editada: DGM
el 10 de Mayo de 2022
@Nguyen Quoc Khanh: t is not a nonzero integer. It can't be used for an index on the LHS of that assignment. You don't need to anyway.
s = cos(2*pi*100*t) + 2*cos(2*pi*200*t+pi/2) + 3*cos(2*pi*200*t+pi/4); % quá trình lấy mẫu
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!