Siyi's metaphysical stuff
Monday, July 27, 2009
Matlab: indexing matrix of unknown number of dimensions
OP here.
Q:
If I know a multidimensional matrix x has 4 dims, I can index the first "row" of x using
x(1,:,:,:)
but how do I do this if I don't know ndims beforehand?
A:
c(1:ndims(x)-1)={':'};
x(1,c{:})
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Siyi
View my complete profile
Followers
Blog Archive
►
2010
(7)
►
March
(5)
►
February
(2)
▼
2009
(34)
►
September
(1)
▼
July
(7)
Matlab: grouping values according to ID
Matlab: handling nan for findstr
Matlab: grouping and add up values according to ID
Matlab: fast way to insert zeros into a vector
Matlab: indexing matrix of unknown number of dimen...
Matlab: counting zeros neighbouring each element
Matlab: optimization
►
June
(6)
►
May
(20)
No comments:
Post a Comment