I need to turn a large data table into a graph

I've got a txt file with 2 columns and about 6000 rows. I've also converted it into an xlsx file, and ive imported both of them to Matlab. However, I cannot figure out how to make my code access either file, and then convert the first column into the x axis, and the second into the y axis, and then plot them against each other.
I have a lot more steps to do after that, but I am beating my head against a wall here just to even start. I know this is simple stuff, but I havent had to use Matlab in the three years since I was forced to learn it, and now It's 100% madatory to use, in most of my classes

Answers (1)

Are your data in MatLab as a variable? If not, there may have been an issue with the import. Try this and see if it gets easier:
A = importdata("YourFile.txt")
x = A(:,1); y = A(:,2);
plot(x,y) %or scatter, or whatever kind of plot you want to make
This link may help you too for more specific instructions: https://www.mathworks.com/help/matlab/ref/importdata.html#btmah78

Categories

Tags

Asked:

on 10 Sep 2019

Answered:

on 10 Sep 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!