1
votes

The excel file has three sheets and contains both text and data. As far as I understand, one can choose to write the number of the sheet that you want to import from, or the name of it enclosed in apostrophes.

The one line of code that I use is this:

[num,txt,both] = xlsread('Lugnet_plan1c.xls',2,'a1:ad11')

And the error message that I get is:

??? Error using ==> horzcat The following error occurred converting from logical to char: Error using ==> char Conversion to char from logical is not possible.

Error in ==> Lugnet_test at 6 [num,txt,both] = xlsread('Lugnet_plan1c.xls',2,'a1:ad11')

I could upload the xls-file, or copy-paste the content of it here if it would help?

2
Your line of code works fine when used with a dummy excel file I've just created. Can you try creating a new (blank) excel sheet, entering a few lines of data, and test if that works? Then try to step towards your larger real file to find where the problem lies. - Chris

2 Answers

0
votes

Blind guess, but Matlab complains on my computer, that the "sheet" argument, in your case 2, needs to be a string. So

xlsread('Lugnet_plan1c.xls','2','a1:ad11')
0
votes

Thanks, guys, for your time. Yeah, my impression is that one can write either the number of the sheet or the name of it, and if you use the name, then it is a string, and needs apostrophies. But my problem was solved with information that you did not have. In my exel file was a column with the words "FALSE". Once I deleted that column, my import command worked fine! If there is a way of importing the file while that column is left in it I don't know, but it doesn't feel worth looking into.:) Thanks again for your time!