append array of 1xn in mat file and as a result it should be look like kxn. k=3
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to append array of 1xn which is having values of each iteration into mat file. eg if iteration=3 and data=1xn then i want that after iterations i will get mat file containing values like 3 rows and n columns. this mat file is inside a loop. I dont want to overwrite the values. in present code it is overwriting it.
thank you.
2 Commenti
Stephen23
il 25 Ott 2018
Modificato: Stephen23
il 25 Ott 2018
Note that save's -append option is very badly named: it should really be named -overwrite or something similar, because it does not "append" data to an existing variable in the .mat file, it actually completely overwrites any existing variable of the same name.
Risposta accettata
Stephen23
il 25 Ott 2018
Modificato: Stephen23
il 25 Ott 2018
You will have to do one of these:
- on each iteration load the data, concatenate, then save the data.
- use matfile.
- collect all of the data into one array, then save it all at once after the loop.
I recommend the third option (because it is the neatest and most efficient). Use matfile for very large data sets.
7 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Environment and Settings 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!