Textscan cannot return anything in Matlab 2013a

1 次查看(过去 30 天)
Dear users
I am using Matlab 2013a on my MAC. I am working on other people's code now to extract string from txt file. These codes work well on Matlab-Windows version but they can not work under my Matlab-MAC version and also my college's Matlab-MAC version:
K>> fnames
fnames =
Index,Initials,Name,MiddleName,LastName,Date
K>> res=textscan(fnames,'%s','delimiter',',')
K>> res
Undefined function or variable 'res'.
fnames is a header string extracted from a txt file using strtok() function
I tried to manually replace fnames with a written string, it works:
K>> fnames='Index,Initials,Name,MiddleName,LastName,Date';
K>> res=textscan(fnames,'%s','delimiter',',')
res =
{6x1 cell}_ _
I am very confused about this, anybody came up with the same problem?
  3 个评论
Tianxiao
Tianxiao 2014-3-4
Sorry for the delay~~ Yes, I found that there is a hidden 'return' value in this variable, after I delete it, it works, Thank you!
Tianxiao
Tianxiao 2014-3-4
This problem came from the different new line character used between Windows and Mac txt editor, right?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by