[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
variable for filename in fopen
From: |
Blitz |
Subject: |
variable for filename in fopen |
Date: |
Mon, 18 Jan 2010 13:11:53 -0800 (PST) |
I need to read a bunch of txt files in a directory. For some reason, fopen
does not like passing a variable instead of an explicitly declared string
(i.e. "File1.txt"). The snippet below creates an array with file names,
then is supposed to open those files, one by one. If I replace 'reading'
with some string, it works. As far as I can tell, the variable 'reading' is
a string, so this should work. Ideas?
list = ls *.txt;
for i = 1:length(list),
reading = list(i, :)
fid = fopen(reading, 'r') % open the file
% do stuff
end;
--
View this message in context:
http://old.nabble.com/variable-for-filename-in-fopen-tp27216869p27216869.html
Sent from the Octave - General mailing list archive at Nabble.com.
- variable for filename in fopen,
Blitz <=