using the Xlsread functon

1 view (last 30 days)
Ahmed BOULMANE
Ahmed BOULMANE on 15 Jul 2015
Commented: Ahmed BOULMANE on 15 Jul 2015
hello! i used the function xlsread to do that:
[num,txt]=xlsread(nameoffile,'C:C')
then
txt(indice,1)='xxxxxxxxxxxxx'
so, when i do that:
FileName =txt(indice,1)
==> the result is :
FileName= 'xxxxxxxxxxxx'
but me, i want to do that: FileName='xxxxxxxxxxxx' ==> FileName=xxxxxxxxxxxx in order to use FileName in my script
  3 Comments
Ahmed BOULMANE
Ahmed BOULMANE on 15 Jul 2015
i want to use it to build a file name: using that : name = ['txt file\',FileName,'.txt']
Ahmed BOULMANE
Ahmed BOULMANE on 15 Jul 2015
So I need another function that can give me the possibility to use the texts that I recovers from the excel file as normal texts

Sign in to comment.

Accepted Answer

Brendan Hamm
Brendan Hamm on 15 Jul 2015
The issue is that txt is a cell array which contains char-arrays. So you need to use curly brackets to extract the character array back out.
FileName = txt{indice,1} % Curly Brackets!
name = ['txt file\',FileName,'.txt']
  2 Comments
Brendan Hamm
Brendan Hamm on 15 Jul 2015
Sorry, almost missed the fact that:
txt(indice,1)='xxxxxxxxxxxxx'
is an invalid statement. You need curly brackets here too.
txt{indice,1}='xxxxxxxxxxxxx'
Ahmed BOULMANE
Ahmed BOULMANE on 15 Jul 2015
thank You :)

Sign in to comment.

More Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!