Index exceeds matrix dimensions problem with this code below :-
Show older comments
c =
1 1 1 6
2 4 2 16
-1 5 -4 -3
N = length(c);
tol= 1e-6;
for ii=1:N-1
for jj=ii+1:N
if abs(c(jj,ii))> tol
fac=c(ii,ii) / c(jj,ii);
c(jj,:) = fac*c(jj,:) - c(ii,:);
end
end
end
how to solve this problem? that code for Gauss elimination when I press enter it appear " Index exceeds matrix dimensions "
Accepted Answer
More Answers (1)
Walter Roberson
on 7 Jan 2018
0 votes
length() of a 3 x 4 array is 4. length() is not the number of rows: length() is defined as:
- 0 if any dimension of the array is 0; or
- max() of size() of the array otherwise.
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!