From: Maria_tab Manioudaki on
"us " <us(a)neurol.unizh.ch> wrote in message <hnta6o$j6f$1(a)fred.mathworks.com>...
> "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message <hnt9jh$8p8$1(a)fred.mathworks.com>...
> > "us " <us(a)neurol.unizh.ch> wrote in message <hnt96c$1qc$1(a)fred.mathworks.com>...
> > > "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message <hnt8t1$q5m$1(a)fred.mathworks.com>...
> > > > I want to read a file that includes a number followed by tab and then a string
> > > > using the
> > > > [A, B] = textread([file, '.mots'], '%d\t%s\n');
> > > >
> > > > and I get this error:
> > > >
> > > > Trouble reading literal string from file (row 1, field 3)
> > > >
> > > > Error in ==> textread at 177
> > > > > [varargout{1:nlhs}]=dataread('file',varargin{:});
> > > >
> > > >
> > > > Any suggestions?
> > > >
> > > > What is (row 1, field 3) refer to??
> > > > Thanks,
> > > > Maria
> > >
> > > can you show a snippet of one of your input files(?)...
> > >
> > > us
> >
> > My input file has the form:
> > 3462 nk
> > 12 kilpoh
> > 1678 THNKIKLO
>
> a hint:
> - use this syntax...
>
> [A, B] = textread([file, '.mots'], '%d\t%s');
>
> us

it won't work... :(
The file is actually a matrix
number/tstring/n
number/tstring/n
number/tstring/n
number/tstring/n
From: us on
"Maria_tab Manioudaki"
> > > My input file has the form:
> > > 3462 nk
> > > 12 kilpoh
> > > 1678 THNKIKLO
> >
> > a hint:
> > - use this syntax...
> >
> > [A, B] = textread([file, '.mots'], '%d\t%s');
> >
> > us
>
> it won't work... :(
> The file is actually a matrix
> number/tstring/n
> number/tstring/n
> number/tstring/n
> number/tstring/n

it works(!)... unless your example was not correct...
a file FOO.TXT was created with the input copy/pasted from your example (including the TABs)...
and this is the output

fnam='foo.txt';
[a,b]=textread(fnam,'%d\t%s');
disp(a);
disp(b);
%{
% a =
3462
12
1678
% b =
'nk'
'kilpoh'
'THNKIKLO'
%}

us
From: Maria_tab Manioudaki on
"Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message <hntaul$2p3$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <hnta6o$j6f$1(a)fred.mathworks.com>...
> > "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message <hnt9jh$8p8$1(a)fred.mathworks.com>...
> > > "us " <us(a)neurol.unizh.ch> wrote in message <hnt96c$1qc$1(a)fred.mathworks.com>...
> > > > "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message <hnt8t1$q5m$1(a)fred.mathworks.com>...
> > > > > I want to read a file that includes a number followed by tab and then a string
> > > > > using the
> > > > > [A, B] = textread([file, '.mots'], '%d\t%s\n');
> > > > >
> > > > > and I get this error:
> > > > >
> > > > > Trouble reading literal string from file (row 1, field 3)
> > > > >
> > > > > Error in ==> textread at 177
> > > > > > [varargout{1:nlhs}]=dataread('file',varargin{:});
> > > > >
> > > > >
> > > > > Any suggestions?
> > > > >
> > > > > What is (row 1, field 3) refer to??
> > > > > Thanks,
> > > > > Maria
> > > >
> > > > can you show a snippet of one of your input files(?)...
> > > >
> > > > us
> > >
> > > My input file has the form:
> > > 3462 nk
> > > 12 kilpoh
> > > 1678 THNKIKLO
> >
> > a hint:
> > - use this syntax...
> >
> > [A, B] = textread([file, '.mots'], '%d\t%s');
> >
> > us
>
> it won't work... :(
> The file is actually a matrix
> number/tstring/n
> number/tstring/n
> number/tstring/n
> number/tstring/n

Well... it worked with
[A, B] = textread([file, '.mots'], '%d%s');

Thank you very much!!
From: dpb on
Maria_tab Manioudaki wrote:
> "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message
> <hntaul$2p3$1(a)fred.mathworks.com>...
>> "us " <us(a)neurol.unizh.ch> wrote in message
>> <hnta6o$j6f$1(a)fred.mathworks.com>...

....

>> > - use this syntax...
>> > > [A, B] = textread([file, '.mots'], '%d\t%s');
>> > > us
>>
>> it won't work... :(
>> The file is actually a matrix
>> number/tstring/n
>> number/tstring/n
>> number/tstring/n
>> number/tstring/n
>
> Well... it worked with [A, B] = textread([file, '.mots'], '%d%s');
....

Well....then there _weren't_ any tabs after all most likely...did you
confirm that w/ a hex dump or other method?

--
From: Maria_tab Manioudaki on
dpb <none(a)non.net> wrote in message <hntcpi$586$1(a)news.eternal-september.org>...
> Maria_tab Manioudaki wrote:
> > "Maria_tab Manioudaki" <Belladonna_98(a)hotmail.com> wrote in message
> > <hntaul$2p3$1(a)fred.mathworks.com>...
> >> "us " <us(a)neurol.unizh.ch> wrote in message
> >> <hnta6o$j6f$1(a)fred.mathworks.com>...
>
> ...
>
> >> > - use this syntax...
> >> > > [A, B] = textread([file, '.mots'], '%d\t%s');
> >> > > us
> >>
> >> it won't work... :(
> >> The file is actually a matrix
> >> number/tstring/n
> >> number/tstring/n
> >> number/tstring/n
> >> number/tstring/n
> >
> > Well... it worked with [A, B] = textread([file, '.mots'], '%d%s');
> ...
>
> Well....then there _weren't_ any tabs after all most likely...did you
> confirm that w/ a hex dump or other method?
>
> --

There were tabs in the file
only it seems that recognize any whitespace as such without
dealing with its nature.

I did not confirm that with hex dump, but I made the file with a previous command
using /t.