Be the first to rate this file! 13 downloads (last 30 days) File Size: 2.02 KB File ID: #22283

readMM_2D

by DS

 

01 Dec 2008

Code covered by the BSD License  

Read 2-D matrix saved with Mathematica 'Put' command.

Download Now | Watch this File

File Information
Description

READMM_2D(file,nrows) reads data from the full path+filename specified by 'file' and parses the data into the number of rows specified by 'nrows'.

If the number of rows is specified the function uses TXT2MAT to read a Mathematica formatted 2D data array. If number of rows is not specified, or if TXT2MAT is not available, the function reads the file with TEXTREAD and automatically determines the number of rows and columns for the input data.

Inputs:
         file -- string variable; fully specified filename
         nrows -- numeric scalar; number of rows in data file
         flagstr -- 'fast' specifies TXT2MAT algorithm (default)
                    'slow' specifies TEXTREAD algorithm

  Example:
           numrows = 1248;
           myfile = 'C:\somefile.txt';
           A = readMM_2D(myfile,numrows);

            ans = <1248x1248 double>

Please note: A separate file exchange submission (TXT2MAT) must be installed to take advantage of the 'fast' algorithm in this submission.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
txt2mat

MATLAB release MATLAB 7.0.4 (R14SP2)
Zip File Content  
Other Files license.txt,
readMM_2D.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
2d Cristina McIntire 01 Dec 2008 15:50:41
read text DS 01 Dec 2008 15:51:02
text file DS 01 Dec 2008 15:51:02
mathematica DS 01 Dec 2008 15:51:02
read ascii DS 01 Dec 2008 15:51:02
ascii data DS 01 Dec 2008 15:51:02
 

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