for eg, i have matrix A=[4 6 3 8 9 5;1 7 2 4 3 4;7 8 5 6 1 2; 1 8 4 7 10 6;] and i use a for loop to go across the column, for i =1:col .... how do i stop it before getting error of matrix exceeds dimensions
in a for loop, i pick call a function, which picks the most smallest elevation change, but when it goes to the edge of the column it says matrix exceeds dimension, this is my code
function[Rows,Cols]=Elevation(c,A)
[row,col]=size(A);
m=currentposition(1);
n=currentposition(2);
currentposition=[m,n]
i=1;
for i=1:col
[pick]=NewElement(currentposition, A); %this is a function im calling
Rows(i)=currentposition(1);
Cols(i)=currentposition(2);
currentposition=pick;
i=i+1;
end end
from this is get columns 1-5 but once it is on column 6 it gives me matrix exceeds dimension
i did that but how do i stop getting error when im at column 6 and its searching for elements next to it, where there isn't any elements present, resulting in matrix exceeds dimensions
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.