文書化されていないMatlabコードがいくつか与えられ、それが何をするのかを理解しようとしています。コードに散在するコメントとして、主な質問を以下に示します。
% x is an array, I believe of dimension (R, 2)
% I understand that the following line creates a logical array y of the same
% dimensions as x in which every position that has a number (i.e. not Nan)
% contains True.
y=~isnan(x)
for k=1:R
% I don't know if z has been previously defined. Can't find it anywhere
% in the code I've been given. I understand that z is a cell array. The
% logical array indexing of x, I understand basically looks at each row
% of x and creates a 1-column array (I think) of numbers that are not Nan,
% inserting this 1-column array in the kth position in the cell array z.
z{k}=x(k, y(k,:))
end
% MAIN QUESTION HERE: I don't know what the following two lines do. what
% will 'n' and 'm' end up as? (i.e. what dimensions are 'd'?)
d=[z{:,:}]
[m,n]=size(d)