MATLABで得られたデータをExcelの各シートに名前を付けて保存したい!
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
斗夢
am 9 Nov. 2023
Kommentiert: Dyuman Joshi
am 9 Nov. 2023
x_data = [1, 2, 3, 4, 5];
y_data = [6, 7, 8, 9, 10];
z_data = [11, 12, 13, 14, 15];
このように3つのデータが得られたとき、その値のそれぞれをExcelのシート別に保存したい。
参考として下図のようなExcelファイルを保存したい。

0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 9 Nov. 2023
x_data = [1, 2, 3, 4, 5];
y_data = [6, 7, 8, 9, 10];
z_data = [11, 12, 13, 14, 15];
str = ["x" "y" "z"] + "data";
arr = table(x_data.', y_data.', z_data.', 'VariableNames', str);
filename = 'data.xlsx';
for k=1:size(arr,2)
writetable(arr(:,k), filename, 'Sheet', str(k))
end
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu スプレッドシート finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!