Please help. I need to read this file and isolate column 2.
Afficher commentaires plus anciens
It appears the data is not separated into columns. Any way to do this?
A = importdata('Psmall.txt');
A1 = A(:,2);
5 commentaires
the cyclist
le 17 Mai 2018
Is there something wrong with doing it the way you just did? I'm pretty sure that just about any other method is going to take even more code to parse things the way you want.
Star Strider
le 17 Mai 2018
Your code as you posted it runs for me without errors (in R2018a) and gives the appropriate output.
A = importdata('Psmall.txt');
A0 = A(:,1);
A1 = A(:,2);
figure
scatter(A0, A1, '+')
grid
Charles Naegele
le 17 Mai 2018
the cyclist
le 17 Mai 2018
To be clear, when I run your code, I get an Nx2 matrix (of data type "double"). As Star Strider said, it is then easy to separate them into the column vector.
Is that what you get?
Charles Naegele
le 18 Mai 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import and Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!