Error-"Index exceeds matrix dimensions"
Ältere Kommentare anzeigen
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)
{.....}
%--------------------
Antworten (1)
James Tursa
am 19 Mär. 2018
Bearbeitet: James Tursa
am 19 Mär. 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.
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!