how to not exceed limits of the matrix column
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
José-Luis
2017년 9월 10일
your_array = rand(10,16)
%looping through all columns
for ii=your_array
%ii now contains all values in column
end
댓글 수: 4
José-Luis
2017년 9월 10일
Columns 1-5 of what? You are not indexing into A and that is the array whose columns you are looping on.
Please use the debugger. Place a breakpoint in the line that's giving you grief and look at the arrays you are indexing into.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!