How to increment matrix row only inside a nested for loop?
조회 수: 2 (최근 30일)
이전 댓글 표시
for i= 1:10{
for j= 1:5{
x = i*j;
mat
}}
matrix's row number index row wise should increment by 1
save this x value in mat matrix's row wise(like 1st row,2nd row,...,50th row).
Please help
답변 (1개)
Bob Thompson
2019년 11월 7일
The solution is indexing. You can do math in your index if you need to.
x((i-1)*5+j) = i*j;
댓글 수: 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!