Code help for data extraction
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Need a code allowing me to input a txt file then search for data corresponding with a given number. For example, in my file there are 20 sets of data containing over 5000 different values in a set. I have the data save in the txt file in two columns. In the end I need to be able to import several different data files and then extract values at a given point. PLEASE HELP ME!!
0 comentarios
Respuestas (2)
Gareth Thomas
el 22 de Mzo. de 2014
Hi Nakarsha,
There are multiple ways of doing this.
Use the Import Tool - in MATLAB, select the text file, right click, import data.
In this tool you can create a script or function (see the Import Selection on the right, click on the little arrow down), which will code the automatically for you this process. You now have a variable in MATLAB, then all you need to do is add to the atomically script what you want.
Probably you will use something like logical indexing to get the values.
In your example you will have multiple files, with data, then all you need to do is a:
a = dir
And get all the txt files, write a for loop, call the function/script you created and continue with your work.
Does this help?
0 comentarios
Image Analyst
el 22 de Mzo. de 2014
The best way is to use readtable() , but that requires R2013b or later. Failing that, if you have a really old version, use csvread(), dlmread(), importdata(), fgetl() and sscanf(), textscan() or something like that.
0 comentarios
Ver también
Categorías
Más información sobre Large Files and Big Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!