On 2011-06-29 15:02, David Winsemius wrote:

On Jun 29, 2011, at 4:56 PM, katarv wrote:

Hi Sarah,

I use readMat function, from R.matlab function.

str(X) tells that

X : num [1:64, 1:64, 1:21, 1:300]  as I said, the first 3 columns
are x,y,z
coordinates. And I need all values in the last column correcponding
to a
given (x,y,z) coordinate.

You should be able to access those values with:

X[1,1,1, ]

or equivalently:

X[1,1,1,1:300]


if you list the values of X,

then they are non zero, but for some reason R
tells that dim(X): NULL

Now that seems a bit odd. What happens if you try:

I think that Katia is not telling us the whole story. According to
its documentation, readMAT returns a *list* named X, presumably in
this case containing just the X element. So my guess is that str(X)
actually said:

 List of 1
 $ X : num [1:64, 1:64, 1:21, 1:300] ....

Naturally, dim(X) is NULL.

Katia probably just needs to do do two things:
1. extract array X from list X (e.g. with X <- X$X).
2. learn to read the documentation of functions she's trying to use.

Peter Ehlers


Y<- X
dim(Y)<- c(64,64,21,300)
Y[ 1, 1, 1, ]


--
View this message in context: 
http://r.789695.n4.nabble.com/4D-data-acsess-tp3633552p3634004.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to