How to save and then append/augment a matrix into another already existing matrix?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi guys, I have got a brief question about saving a file. I have a file named myfile.mat, (meaning this file already exists) and it contains let's say a matrix M of size 20x4 with all-zero elements. Now I want to run a code that produces a matrix N inside a loop of sizes 3x4 where 3 is the number of cycles of that loop. So putting it into a code would look like:
for j = 1:3
.
.
.
.
.
N(j,:) = [a vector of length 4];
end
In the end I will get matrix N of size Cx4. Then I would like to save N into myfile.mat by replacing the elements in M in the rows whose indices match that of the loop indices. So in the above case I would want to fill from 1st to 3rd row of M with the elements of N leaving the other elements in another rows unaffected. Should I set the cycle indices to run from let's say 5 to 10 (j=5:10) then I will fill only elements in row 5 to 10 of M.
Any suggestion for how to do this? Thanks for the help.
댓글 수: 0
채택된 답변
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!