Excelのセルへの記入方法について

40 visualizzazioni (ultimi 30 giorni)
Nakasima
Nakasima il 7 Mag 2021
Commentato: Nakasima il 11 Mag 2021
xlswrite関数を用いてExcelの指定したセル内に文字列を記入したいのですが、記入すると指定したセルから右のセルへ一文字ずつ入ってしまい、指定した一つのセルだけに文字列が入りません。どのような解決方があるのか教えて頂けないでしょうか?

Risposta accettata

Hernia Baby
Hernia Baby il 7 Mag 2021
おそらくデータ型がcharになっているからだと思います。
試しにstr,cell,charの3種をxlwriteしてみました。
clc,clear,close all;
str1 = "Sample"+char('A'+(0:25)');
str2 = cellstr(str1);
str3 = char(str1);
xlswrite('test.xlsx',str1,'Sheet1');
xlswrite('test.xlsx',str2,'Sheet2');
xlswrite('test.xlsx',str3,'Sheet3');
str3(Sheet3)だけが分離していることがわかります。
ですので、str型かcell型に変換することをお勧めします。
データ型については以下を参考ください。
  1 Commento
Nakasima
Nakasima il 11 Mag 2021
ありがとうございます。無事に解決出来ました。

Accedi per commentare.

Più risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!