4.46154

4.5 | 13 ratings Rate this file 245 downloads (last 30 days) File Size: 6.61 MB File ID: #16075

Textscantool

by Stuart McGarrity

 

23 Aug 2007 (Updated 05 Aug 2009)

Code covered by BSD License  

GUI to read large text files

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

Textscantool is an interactive GUI 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.

MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Published M Files Textscan Tool Help
HTML Files The MathWorks Text Scan Tool Video Tutorial
Other Files license.txt,
textscantool.fig,
textscantool.m,
Video Tutorial/FlashTemplate.css,
Video Tutorial/ProductionInfo.xml,
Video Tutorial/swfobject.js,
Video Tutorial/textscantool.js,
Video Tutorial/textscantool.swf,
Video Tutorial/textscantool_config.xml,
Video Tutorial/textscantool_controller.swf
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (26)
27 Aug 2007 Matteo Sorci

Excellent tool. I was looking or something similar for a while and finally it appears! Thanks a lot!

27 Aug 2007 steohen hope

it's really a usefull tool for import data!

27 Aug 2007 Marcelo Perlin

Tks Stuart. Excelent tool.

15 Nov 2007 L Li

bug in line 82

01 Feb 2008 A K

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'.

01 May 2008 Vick Engineer

Love the tool. Wish the Import Wizard had similar functionality.

Enhancement request:
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.

05 May 2008 w s

works like a charm. Thanks a lot!

17 Jun 2008 Max J

generated code runs real quick

17 Jun 2008 best matlabber

too sweet!

24 Sep 2008 J Kim

>> textscantool
??? Too many inputs.

Error in ==> textscantool at 82
pushButtonHandlesCell=cellfun(@(x) findobj(fig,'Tag',x),pushButtonHandlesGUITags,'Uniform',false);

Could you please let me know what's wrong?

27 Jan 2009 Gene Leynes

OMG, this thing is the cat's meow. I can't believe Mathwork's doesn't have something like this.
Some ideas:
+ 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!)

27 Jan 2009 Michael Jordan  
28 May 2009 Farah

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!

28 May 2009 Farah

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

20 Aug 2009 Matteo

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.

20 Aug 2009 Stuart McGarrity

I can't reproduce this in 9a. Have you checked that you have the fig file? If so, have you tried downloading again?

21 Aug 2009 Matteo

Yes Stuart I've checked and I also tried to download it again....I had the same problem on another PC as well...really strange ..I will try to investigate more on my side as well.

10 Sep 2009 Eleni Vlachou

Hi,

I tired using this, seems amazing and exactly what I need but I get this error:

??? Undefined command/function 'verLessThan'.

Error in ==> textscantool at 125
if verLessThan('MATLAB','7.6') % Before 8a
 I have matlab 7.1

Any thoughts? Thank you very much.

Eleni

10 Sep 2009 Stuart McGarrity

What version of MATLAB do you have? This file only works for release 7a (MATLAB 7.4 ) or later.

10 Sep 2009 Eleni Vlachou

Hi,

I have 7.1 :-( Is there anything else similar to this? I was so happy I found this.

Thank you.

Eleni

10 Sep 2009 Stuart McGarrity

Add this line at the beginning of textscantool.m
versionStr=version;

Then replace both instances of:
if verLessThan('MATLAB','7.6')

With:
if str2double(versionStr(1:3))<7.6

It should work in version 7.1

10 Sep 2009 Eleni Vlachou

It worked!!!!!!!!!!!! Thank you so much. I really appreciate your help.

Eleni

22 Sep 2009 Stephen Lienhard  
19 Oct 2009 burcu

Hi Stuart,

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?
Thanks!
Burcu

19 Oct 2009 Stuart McGarrity

Don't add the code at the very begining. Add if just before the first "if str2double..." line you insert.

19 Oct 2009 burcu

Thanks for the advice Stuart but now i have 2 new errors. Sorry not to mentioning it first but my version is 7.2.0.232, could it be the reason?

??? Operands to the || and && operators must be convertible to logical scalar values.

Error in ==> uitable at 170
            else if (isnumeric(varargin{i+1}) && size(varargin{i+1}) == [1 3])

Error in ==> textscantool at 127
    uitableJavaHandles.lineStringsTable=uitable('Parent',fig,'Data',1, 'ColumnNames',{''},'gridcolor',GUIcolor);

Please login to add a comment or rating.
Updates

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.

21 Apr 2008

Removed 8a warning

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.

30 Jul 2009

Typo work.

04 Aug 2009

Copyright work.

05 Aug 2009

Removed gif.

Tag Activity for this File
Tag Applied By Date/Time
data import Stuart McGarrity 22 Oct 2008 09:24:14
data export Stuart McGarrity 22 Oct 2008 09:24:14
textscan large data text file import gui memory Stuart McGarrity 22 Oct 2008 09:24:14
potw Cristina McIntire 07 Nov 2008 13:20:53
data export Pietro 14 Mar 2009 12:11:22
data import Raushan Kumar 18 Apr 2009 22:39:16
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com