I´m trying to import some csv files in matlab, but csvread is too slow.
I´m using txt2mat, but i don´t know how to skip the first column in the import.
This is the way im trying
myimportedfile = txt2mat(myfile,'ReadMode','block',1) %im skipping the headers too.
The reason i need to skip is beacause the first column is non-numerical data.
Is there a way to do this with txt2mat or is there a better way?
Tks in advance.
textscan gives you the ability to skip columns. It reads in data using an fprintf-like format string.
Example file:
Val1 Val2 Val3
1 2 3
4 5 6
7 8 9
Code:
tmp = textscan('example.txt', '%i %*i %i') % the * indicates fields to ignore
tmp{:}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With