空行列の判定方法
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
セル配列のある場所が空行列[]であったとき、それを判定してある数字を代入したいです。
具体的には、A{1,1}(1,:)が[]のとき、A{1,1}(1,:)=[0 0];
としたいです。
宜しくお願い致します。
0 Kommentare
Antworten (1)
Akira Agata
am 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]};
0 Kommentare
Siehe auch
Kategorien
Mehr zu Other Formats 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!