I've one file (file.csv) filled with integers in the following format:
1,2,3,4,5,6,7,8,9,100
2,5,1,3,4,6,7,8,10,200
I know that using this code:
load('FILE.csv')
x = FILE
x
will be a NxM
matrix,where..
N
is the number of rows in the text file (in the example above:N=2
)M
is the number of numbers (divided by comma) in each row (in the example above:M=10
)
My goal is something similar.
I want to get two matrices:
The First matrix (y): This is the same matrix as "x" but without the last column (In the example above this is the same of loading in the matrix the following file:
1,2,3,4,5,6,7,8,9
2,5,1,3,4,6,7,8,10
so the result matrix is a N*(M-1)
matrix (N=2
, M=10
) ==> 2 rows , 9 columns
|1 2 3 4 5 6 7 8 9 |
|2 5 1 3 4 6 7 8 10|
The Second matrix: This is the remaining column (or more simply: a N*1 matrix and we have a row for each element of last column)
In the example above the matrix would be:
|100|
|200|
What is the easiest way to do this? (I'm a MATLAB beginner).
Thank you in advance for any hint!