27 x 12 の行列がある場合、空の要素がいくつかあります。そのようです、 [ ]
[ ] の要素を -1 に置き換えようとしています。
これを行う最善の方法は何ですか?
セル配列について話していると思います。
この場合、最も簡単な方法は次のとおりです。
%# create some sample data
C = {1,2,[];3,[],99};
%# replace empty elements with -1
[C{cellfun(@isempty,C)}] = deal(-1);
%# or, simpler (thanks @EitanT)
C(cellfun(@isempty,C)) = {-1};
%# just in case you want to turn C into a numeric array
numericC = cell2mat(C);