Afficher commentaires plus anciens
セル配列のある場所が空行列[]であったとき、それを判定してある数字を代入したいです。
具体的には、A{1,1}(1,:)が[]のとき、A{1,1}(1,:)=[0 0];
としたいです。
宜しくお願い致します。
Réponses (1)
Akira Agata
le 8 Jan 2021
以下の方法ではどうでしょうか?
% 例として、A(1,2)とA(2,1)がカラのセル配列を作成
A = cell(2,2);
A{1,1} = rand(2);
A{2,2} = rand(2);
% カラのセルのインデックスを取得
idx = cellfun(@isempty,A);
% カラのセルに [0 0] を格納
A(idx) = {[0 0]};
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox 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!