Error-"Index exceeds matrix dimensions"
Mostrar comentarios más antiguos
So i have this loop in which i want to calculate the magnetic_field_ through fucntion igrf.At the end of every repetition i want to display the current value of magnetic_field_.It only calculates the value for i=1 and then i have the error (Index exceeds matrix dimensions)
(for i=1:1:8
magnetic_field_ = igrf(time,A(i,1),A(i,2),alt,'geodetic');
{......}
end)
%-----------------
function [Bx, By, Bz] = igrf(time, latitude, longitude, altitude, coord)
{.....}
%--------------------
Respuestas (1)
James Tursa
el 19 de Mzo. de 2018
Editada: James Tursa
el 19 de Mzo. de 2018
You need to examine A and determine why it is not the size you expected. E.g., at the command line type this:
dbstop if error
then run your code. When the error happens the code will pause at the offending line with all current workspace variables intact. Examine the variable sizes and then figure out why the sizes are not what you expected.
1 comentario
Dimitris Dirokaltstis
el 19 de Mzo. de 2018
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!