writing string into excel

I am trying to simply write cell string array to excel
xlswrite(ExclFl,cellstr("1.1234"),'A1:A1');
or
xlswrite(ExclFl,{'1.1234'},'A1:A1');
in excel the written string is shown as 11.234, I tried to change the format of the cell but no luck.
Another strange observation is that if I have a string like
xlswrite(ExclFl,{'0.1234'},'A1:A1');
then it is correctly shown in excel.
Any idea?

4 件のコメント

dpb
dpb 2020 年 5 月 8 日
Can't reproduce here.
Af
Af 2020 年 5 月 8 日
I am using
MATLAB Version: 9.7.0.1216025 (R2019b) Update 1
Excel 2016
windows 10
it could be that some specific settings are different on my computer but I have no clue which setting I may need to check.
Afshin
dpb
dpb 2020 年 5 月 8 日
Same ML Release, Excel version, still Win7 though.
While didn't test on W10, I've never observed such on that system either, so agree must be something unique to your setup.
What happens if you use writetable instead of xlswrite?
Af
Af 2020 年 5 月 12 日
Writetable does the trick. I do not have problems with that.

サインインしてコメントする。

回答 (1 件)

Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 5 月 11 日

0 投票

Hi,
I could not reproduce the same at my end too. I guess there might be a cache issue. Try using the following commands.
rehash toolbox
rehash toolboxcache
Hope this helps!

4 件のコメント

Af
Af 2020 年 5 月 11 日
Hi,
Thanks for the hint but I still have the same issue. Aloing with the same issue when I write a string like "704109.9029" to excel I get something like "7.041.099.029" so I then have difficulty to figure out which one is the decimal point.
Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 5 月 11 日
dpb
dpb 2020 年 5 月 11 日
Same Q? as above...what if you use writetable instead? Would prove whether it is MATLAB/xlswrite that is the problem or a system/Excel issue. The above looks like locale settings issues may be in the way.
Af
Af 2020 年 5 月 12 日
Writetable does the trick. I do not have problems with that.

サインインしてコメントする。

質問済み:

Af
2020 年 5 月 8 日

コメント済み:

Af
2020 年 5 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by