Error-"Index exceeds matrix dimensions"
이전 댓글 표시
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)
{.....}
%--------------------
답변 (1개)
James Tursa
2018년 3월 19일
편집: James Tursa
2018년 3월 19일
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.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!