エクセルファイルの区切り位置の設定
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
拳志朗
le 31 Oct 2023
Réponse apportée : Atsushi Ueno
le 31 Oct 2023
テキストファイル形式に記載されたデータをエクセルファイル形式に変換した際や,解析により得られたエクセルファイルは全てのデータがA列にあるためこれを分割し,値ごとに独立したcellに入れたい.この時どのようにコードを作成したら良いでしょうか?
0 commentaires
Réponse acceptée
Atsushi Ueno
le 31 Oct 2023
「1次元に整列してしまった2次元データを元に戻したい」と解釈しました。
data = readtable("sample.xlsx",ReadVariableNames=false);
data = table2cell(data) % 1列のデータ(10行12列のデータが1列になっている)
data = reshape(data,[],10) % 1次元→2次元に変換(10行12列だが並び順の都合で12行10列にする)
data = data' % 転置(これで本来の並び順10行12列になる)
data = data(:) % 2次元→1次元に変換(元のファイルとは行と列の並び順が入れ替わった)
data = reshape(data,[],12)' % 1次元→2次元に変換
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur スプレッドシート dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!