Please help. I need to read this file and isolate column 2.
Show older comments
It appears the data is not separated into columns. Any way to do this?
A = importdata('Psmall.txt');
A1 = A(:,2);
5 Comments
the cyclist
on 17 May 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
on 17 May 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
on 17 May 2018
the cyclist
on 17 May 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
on 18 May 2018
Accepted Answer
More Answers (0)
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!