0

I have a list of filenames saved in a 51X1 cell matrix obtained by using this function and i want to use fastaread or any other matlab txt reading function to read those files.

They are in the following form:

C:\Users\mixalic\Desktop\fastasequences\AB062619_FASTA_328312477664609773.txt

the problem is that when i use

fastaread(filelist(i))

i get the following error:

Error using fastaread (line 53)
Input must be a character array

i tried to convert my cell array to character array but then it will only read C: and report:

Error using fastaread (line 158)
Input does not exist or is not a valid FASTA file.

or when i use load:

Error using load
Unable to read file C: No such file or directory.

Any help?

Thank you very much

Community
  • 1
  • 1
  • 2
    `fastaread(filelist{i})` should work. If it doesn't, check `exist(filelist{i},'file')`. – Jonas Oct 24 '14 at 14:23

1 Answers1

1

You should access the elements of the filelist with curly brackets. If you use normal brackets Matlab returns a 1x1 cell array.

This

filelist = {'C:/path/to/file.txt'};
foo = filelist(1);
bar = filelist{1};
whos 'foo' 'bar'

outputs:

Name      Size            Bytes  Class    Attributes
bar       1x19               38  char               
foo       1x1               150  cell  
hitzg
  • 12,133
  • 52
  • 54