"Fiboehh " <stig_dooms@hotmail.com> wrote in message
news:ka0odg$clv$1@newscl01ah.mathworks.com...
> dpb <none@non.net> wrote in message <k9vtoo$100$1@speranza.aioe.org>...
>> On 12/8/2012 11:12 AM, Fiboehh wrote:
>> ...
>>
>> > I have just the same code as you, but MATLAB gives sometimes error with
>> > files which work fine if I load them in one by one :s
>> > If my ascii-file is named 1_01.txt everything works fine, but if I use
>> > 2_01.txt it gives a fellowing error;
>> >
>> > Error using importdata (line 137)
>> > Unable to open file.
>> >
>> > Error in ScienceWeek (line 11)
>> > log = importdata(fnames(k).name);
>> >
>> > Do you have a clue what is going wrong?
>>
>> The error indicates the file probably doesn't exist -- perhaps you don't
>> have the correct working directory or it could possibly be protected or
>> the name isn't actually correct...
>>
>> Other than that, from here it's hard to say.
>>
>> Might try using debugger and when it errors poke around at the command
>> line and see what local context is at that point. Probably will be
>> illuminating...
>>
>> --
> Unbelieveble strange, but it just doesn't work with certain names. It must
> be something with the internal syntax in MATLAB. A bug or something, but
> if I import a text file in under the name 'a.txt' it gives an error:
> unable to open file, and if I rename the same file to '1_01.txt' it works
> :s :s
It _could_ be a bug, but I doubt it.
Try using FOPEN with two outputs to open the file. If the first output
is -1, look at the second output. It will be the message from the OS
hopefully identifying why it couldn't open the file. That may shed some
light on why you received an error from IMPORTDATA. My guess is either that
you have too many files open simultaneously or you already have it open in
some other program.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com