loading a 2d matrix from a text file comes in as an array
Mostrar comentarios más antiguos
I have two columns of data in a text file that I'm trying to read in using the load function. For some reason it is loading the file as a single array (1 x 1340) instead of a matrix (670 x 2). I am using the 2012a and I'm on a Mac.
1 comentario
Kolbein
el 22 de Feb. de 2013
Respuestas (1)
Azzi Abdelmalek
el 22 de Feb. de 2013
If its loading as a single array, depending on the order of your data you can For example:
x y
1 10
2 20
3 30
If the data comes like
data=[1 2 3 10 20 30]
n=numel(data)
x=data(1:n/2)
y=data(n/2+1:end)
If data comes like
data=[1 10 2 20 3 30];
x=data(1:2:end);
y=data(2:2:end)
Categorías
Más información sobre Text Files en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!