How to set an index on a table
Ältere Kommentare anzeigen
I have an csv file and am reading it using readtable(). I want to set a index on this table for fast access of data (something similar to set_index in python(pandas)).
T=readtable('file.csv');
index1=find(T.column1==value1);
index2=find(T.column2==value2);
index=intersect(index1,index2);
sam=table2array(T(index,6));
I want to do this for different values of value1 and value2 (approx 12000 times). This is taking about 600 seconds for 12000 records. Is there a way to access the table fast?
Thanks in advance.
1 Kommentar
per isakson
am 2 Okt. 2017
Bearbeitet: per isakson
am 2 Okt. 2017
- If your file contains only numerical data, I think working with old time matrices rather than tables will make a significantly faster code.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Tables finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!