Code covered by the BSD License  

Highlights from
readMM_2D

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

readMM_2D

by

 

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

| 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

Txt2mat inspired this file.

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us