Extracting data from a table(.mat file)
Mostra commenti meno recenti
I have a .mat file which consist of a table( size- 19x3659). I need to extract data from it in the following pattern. Column 1-3 (Then after a gap of 128) Column 129-131 column 385-387....and so on. All the rows are to be considered.
I have no clue about this. New to MATLAB. Any help would be appreciated.
1 Commento
Abhivyakti
il 16 Lug 2012
Risposta accettata
Più risposte (2)
Image Analyst
il 16 Lug 2012
Modificato: Image Analyst
il 16 Lug 2012
Something like this (untested):
% Load mat file.
s = load(fullMatFileName);
% Extract the table. Hopefully it's a numerical array called theTable.
theTable = s.theTable;
% Get columns to extract out
[rows columns] = size(theTable);
columnsToExtract = [];
for c = 1 : 128 : (columns-3)
% Add these 3 columns.
columnsToExtract = [columnsToExtract , c, c+1, c+2];
end
% Create the new table.
newTable = theTable(:, columnsToExtract);
Albert Yam
il 16 Lug 2012
original = magic(10);
In the form of, selected = original(rows,columns);
selected = original([1:2 5 8:9] , [3 5:7])
Which is rows 1-2,5,8-9 and columns 3,5-7 play around with it. Good luck.
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!