Build a matrix from saved arrays with differents lengths
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi to all!
I'm working on a simulation program. Each time the programs ends a simulation it saves the data (an array sized of 1 row and multiple columns) to a single .mat file: 'rf_ln1.mat'
For each simulation array size can change.
So, now: How can I construct a matrix from this saved different sized arrays? Because I don't know the size of each saved line unless I load them.
For example: rf_ln1.mat, rf_ln2.mat... rf_ln129.mat M = [rf_ln1.mat rf_ln2.mat ... rf_ln129.mat];
1. Is there an easy way such as using a struc or cell or a function? 2. Any tips? Ideas? Has someone already done this?
I would do: load file save it into a struc or cell (o create a variable with the name) seach the biggest one create a zero matrix sized (1,biggestone) create for each array a new one with the max size of all arrays insert it in the zero matrix
Any ideas with no so much steps?
Thanks for your answers! :)
0 Commenti
Risposta accettata
Walter Roberson
il 23 Gen 2012
You can use whos() with the -file option in order to find the matrix sizes without loading the files.
2 Commenti
Walter Roberson
il 23 Gen 2012
http://www.mathworks.com/help/techdoc/ref/whos.html
s = whos('rfline_post', '-file', 'rf_data/rf_post_In1.mat');
s.size
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Data Type Identification 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!