R has a very difficult, yet probally extremely powerful scheme called "dataframe". Because of its intrication, saving and reading can be difficult for a beginner like me.
Suppose Mat is Matrix. The following will save in the text file that is readable from Matlab.
write.table(Mat, "Matrix", sep = ",", row.names = FALSE, col.names = FALSE)
Howver, the matrix saved this way cannot be read from R. When R reads a text file, it considers the column as "names" in data.frame attributes. Without the prescribed names, R will confuse names with values.
data.frame attributes:
names: category. e.g. Sex
class: class of the category "Name". e.g. Male
row.names: subjects. e.g. Josh, Mary
Instead, we shall
write.matrix("Matrix". sep = ", ")
When you do this, we can recover the file with
M = read.csv("Matrix", header = FALSE)
M extracted this way, however, is data.frame.
its columns are given the name Vk, and
its rows are enumerated.
To extract the column, simply call M$Vk.
To extract the row, as.numeric(M[k, ]) will do.
You might want to prepare a separate matrix into which you copy thes numerics.