Note: Does not work in release 2014a or later. For these releases use the built-in MATLAB "Import Tool" accessed by selecting "Import Data..." from the current folder window.
Textscantool is an interactive app to read large text files with delimited data. The tool lets you specify which columns to read and what data types to use. It can also generate the MATLAB code to carry out the same task programmatically. There is a video tutorial for this tool in the directory that comes with this submission. Unzip the files to the current directory or somewhere on your path.
This is definitely a nice tool. However, the folks who generate some of the data files I have have thrown a few curve balls. While I can reprocess the data from strings, I don't think it would be hard for you to add a few new features.
1. A new class of logical which translates strings of f or false or 0 or off to logical false (any case) and t or true or 1 or on to logical true.
2. A class which takes a set of string values that have a limited set of possible values and translates them into numbers. For example, there might be three different status types, e.g., standby, off, and on. We might like to put in numbers such as 0 for standby, 1 for off, and 2 for on. It would be handy to have textscantool do that translation rather than have us do the conversion later.
Great file, it helped me a lot to read some messy data that I have, however, I need to figure out now how many rows does my files has, any thought or ideas to work this out?
PS.: Sorry for the blanks post before... my bad
I was facing same issue with Eleni and applied your items and get another error:
??? Error: File: textscantool.m Line: 2 Column: 1
Function definitions are not permitted at the prompt or in scripts.
Do you have any comment on this?
did anyone experience an error using this fantastic tool on Matlab 2009a? I have this problem when launching it:
Warning: an error occurred while parsing class uitools.uibuttongroup:
Attempt to reference field of non-structure array.
> In hgload at 43
In openfig at 72
In textscantool at 66
??? Attempt to reference field of non-structure array.
My problem above was easily fixed, I had not entered in the right key for tab delimited, which is '\t'. Stuart pointed this out to me :). Textscantool worked super fast after, opening what it said would take an hour in a second
Hi, this is just what I needed!!!! thanks so much for uploading. I'm working with microarray data (2.1 million rows and multiple column .txt files) and need to selectively import rows, so it's perfect.
But I have encountered a problem. My .txt files are tab delimited, however textscantool reads it as comma delimited. I tried changing the delimiter manually substituting '|' for ',' but that didn't help. Can you please let me know how to fix this? thanks!
OMG, this thing is the cat's meow. I can't believe Mathwork's doesn't have something like this.
+ Read the first few row(s) of data to test columns for number values for smarter defaults (rather than all strings). I wrote something like this in VBA if you’d like it.
+ Include brief data definitions for the data types (do I need an int32 or int64? I don’t know!)
24 Sep 2008
??? Too many inputs.
Error in ==> textscantool at 82
Could you please let me know what's wrong?
17 Jun 2008
17 Jun 2008
generated code runs real quick
05 May 2008
works like a charm. Thanks a lot!
01 May 2008
Love the tool. Wish the Import Wizard had similar functionality.
When bringing in data that contains one column of dates and the rest numbers, upon selecting the column that contains dates and then selecting the radio button to apply the datenum function, the entire data cannot be brought in a 2D numerical array. I would think that after applying the datenum function all columns are now of the same type.
01 Feb 2008
Can't make this work. Any suggestions? These are the error.
??? Error while evaluating uicontrol Callback.
??? No method 'newDocument' with matching signature found for class 'com.mathworks.mlservices.MLEditorServices'.
15 Nov 2007
bug in line 82
27 Aug 2007
Tks Stuart. Excelent tool.
27 Aug 2007
it's really a usefull tool for import data!
27 Aug 2007
Excellent tool. I was looking or something similar for a while and finally it appears! Thanks a lot!
Try upload again
07 Sep 2007
Changed name of generated function to 'dataimport' to avoid clashing with existing 'importdata' function
08 Feb 2008
Fixed bug causing error with short files.
05 Apr 2009
Fixed bug in line count (sometimes off by 1). Fixed example date format to a valid one. Thanks to Michael Weidman for these.