csvread and dots in filename

Hello,
I know matlab script files don't accept filenames with many dots.
But my problem is different. I am trying to read a text file with csvread, and I get file not found error if the filename contains a dot other than the file extension separator.
I cannot rename these files because these files are generated and appended by another software. Renaming them breaks the updates.
How can I make csvread work?
Thanks
[Merged from duplicate]
I am really in trouble. fopen fails to open if filename contains @ symbol or extra . other than the one before file extension. I have so many files to load with these symbols.
I also tried csvread and dlmread, same problem.
Is there any other way to load files in Matlab?
Thanks

Respuestas (2)

Walter Roberson
Walter Roberson el 24 de Feb. de 2013

0 votos

csvread() is a wrapper around dlmread() which in turn is a wrapper around textscan(). You could use textscan() directly.

3 comentarios

Cagdas Ozgenc
Cagdas Ozgenc el 9 de Mzo. de 2013
Doesn't work. fopen itself fails if the filename contains an extra . or @ symbol.
Walter Roberson
Walter Roberson el 9 de Mzo. de 2013
Could you give an example?
Also which operating system and MATLAB version are you using?
Cagdas Ozgenc
Cagdas Ozgenc el 9 de Mzo. de 2013
Editada: Cagdas Ozgenc el 9 de Mzo. de 2013
I am trying on R2011b windows 8.
@AAE-I_INDEX_S&P Custom_ABN AMRO Renewable.csv
AZO_NYSE_Autozone Inc..CSV

Iniciar sesión para comentar.

per isakson
per isakson el 9 de Mzo. de 2013
Editada: per isakson el 9 de Mzo. de 2013

0 votos

This works for me on R2012a 64bit
>> fid = fopen( '@AAE-I_INDEX_S&P Custom_ABN AMRO Renewable.csv', 'r' );
>> cac = textscan( fid, '%[^\n]' )
cac =
{1x1 cell}
>> cac{:}{:}
ans =
?FROM 192.168.7.2:658161? 058 032 ...
>>
and this too
>> fid = fopen( 'AZO_NYSE_Autozone Inc..CSV', 'r' );
>> cac = textscan( fid, '%[^\n]' )
cac =
{1x1 cell}
>> cac{:}{:}
ans =
?FROM 192.168.7.2:658161? 058 032 055 ...
>>

5 comentarios

Cagdas Ozgenc
Cagdas Ozgenc el 9 de Mzo. de 2013
Which OS are you using?
per isakson
per isakson el 9 de Mzo. de 2013
win7
Cagdas Ozgenc
Cagdas Ozgenc el 9 de Mzo. de 2013
OK Thanks. Then either it is OS or MATLAB version. I will try to find somebody with 2012a. If that also fails then it is an Windows 8 issue I suppose. When I rename the files by removing the symbols it reads just fine.
Walter Roberson
Walter Roberson el 9 de Mzo. de 2013
Works for me on R2012a on OS-X Lion.
Cagdas Ozgenc
Cagdas Ozgenc el 9 de Mzo. de 2013
Does MATLAB use Visual C++ Redistributable or some other C library? If so maybe I should upgrade the C library without touching Matlab.

Iniciar sesión para comentar.

Categorías

Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 24 de Feb. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by