Azzera filtri
Azzera filtri

How to save and then append/augment a matrix into another already existing matrix?

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

per isakson
per isakson il 13 Set 2014
Modificato: per isakson il 13 Set 2014

Più risposte (1)

Imam
Imam il 13 Set 2014
Thanks to you both, that really describes the solution to my problem.

Categorie

Scopri di più su Workspace Variables and MAT-Files in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by