1.0

1.0 | 1 rating Rate this file 9 downloads (last 30 days) File Size: 2.13 KB File ID: #11667

file2str

by Wolfgang Garn

 

09 Jul 2006 (Updated 10 Jul 2006)

Code covered by the BSD License  

converts a text file into a cell array

Download Now | Watch this File

File Information
Description

file2str Reads a text file into a cell array of strings

Input:
* file ... name of the file, i.e. file = 'test.txt'

Output:
* str ... cell array of strings
* fullPath ... path + filename + extension
* file ... filename
* directory ... path to file

Example
Write cell array to textfile.
+ str2file( {'aa','bbbb','','cc'}, 'test.txt' );
Read the text file with
+ t = file2str( 'test.txt' )

See also: str2file

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
11 Jul 2006 urs (us) schwarz

this copyright snippet is a simple call to TEXTREAD

s=textread(fnam,'%s',...
     'delimiter','\n',...
     'whitespace','');

us

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Wolfgang Garn 22 Oct 2008 08:32:22
data export Wolfgang Garn 22 Oct 2008 08:32:22
file2str Wolfgang Garn 22 Oct 2008 08:32:22
file to string cell array Wolfgang Garn 22 Oct 2008 08:32:22
read text file Wolfgang Garn 22 Oct 2008 08:32:22
text file into a c Wolfgang Garn 22 Oct 2008 08:32:22
 

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