Cell配列の連結に伴う要素数の追加
Afficher commentaires plus anciens
A = struct2cell(matfile3);
name = fieldnames(matfile3);
for i = 1:size(A,1)
Output.(name{i}) = [A{i,1}, A{i,2}];
end
Output
の部分なのですが、入力するmatfile(フィールドなどの構造は同じ)の数を可変にしたい場合、どのようにすればいいですか。マットファイルの数が変数Xとおいて考えた場合のコードがいまいちわかりません。
例えば、X = 5だとして
A = struct2cell(matfile3);
name = fieldnames(matfile3);
for i = 1:size(A,1)
Output.(name{i}) = [A{i,1}, A{i,2}, A{i,3}, A{i,4}, A{i,5}];
end
Output
と同じ結果になるようにしたいです。(毎回、「A(i,〇〇)」)と書くのは大変なので。。。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur cell 配列 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!