Error using xlswrite. Invalid sheet name '1'.
古いコメントを表示
Hi! I am writting to see if you can help me with a strange issue that appeared me without any explanation...
I would like to use the xlswrite function this way:
data = 1:2;
filename = 'file.xlsx';
xlswrite(filename,data)
And I don't know why, I get this error:
Error using xlswrite (line 219)
Invalid sheet name '1'. Sheet names cannot exceed 31 characters and cannot contain any of these characters:
': / ? * [ ]'.
Does that make sense? I am not setting any kind of sheet name and it is complaining about it. So, looking to the help xlswrite menu I can see that the ARRAY field should be a cell, not a double. Ok, so changing this does not make the difference either...
I have also tried to use the activeX way to create a excel file and everything works fine, but it is quite tedious to make my own "xlswrite" function... I would like to know how to solve this problem with xlswrite.
Could you help me?
Thanks! Andres Fonts
[EDIT] Solved! The xlswrite function was corrupted. There was a code error in line 258.
採用された回答
その他の回答 (2 件)
Gabriel Delcros
2017 年 1 月 31 日
0 投票
You may have to try :
xlswrite ('file.xlsx', data)
If file is already created, he would find it. Or put the path ;)
Gabriel Delcros
2017 年 1 月 31 日
0 投票
Oh I know, there is a problem with your data. It does not make sens to him.
Try data = [1:2];
3 件のコメント
data = [1:2]
concatenates exactly one thing (a vector) with nothing else, so is equivalent to this:
data = 1:2;
Many beginners get confused by the fact that [] is not a "list" operator (MATLAB has not variable type "list"). The unnecessary use of square brackets has been discussed on this forum several time:
MATLAB beginners should also learn how to check equivalence using isequal:
>> data1 = 1:2
data1 =
1 2
>> data2 = [1:2]
data2 =
1 2
>> isequal(data1,data2)
ans = 1
Jan
2017 年 1 月 31 日
Andres Fonts
2017 年 1 月 31 日
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!