Reputation: 3
I'm currently working on one mathematical algorithm on C, but I found a realization on matlab. The problem is that I don't know syntax. Can anybody explain me whats the meaning of this code?
[data(:,nt)'; zeros(nz-1,nx)]
nz
, nx
, nt
are integers and data is a nx
x nt
matrix.
Upvotes: 0
Views: 101
Reputation: 23
Simon did most of the explaining, but remember that nt
might be a matrix. Say nt = [1 2 3 1]
. This would return columns 1, 2, 3 and 1 (anew), concatenated horizontally.
Upvotes: 1
Reputation: 32873
data(:,nt)
means all rows (:
) of column nt
of the data
matrix. The apostrophe ('
) means take the transpose of that.
zeros(nz-1,nx)
means a matrix filled with zeros of size nz-1
x nx
.
The [ ... ; ...]
construct means vertical concatenation of the two matrices.
Upvotes: 4