Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to plot text file in MATLAB

  1. Oct 24, 2015 #1
    I had to use a network analyzer measuring the standing wave pattern along a transmission line taking data points at half mm increments. The software I used got me the values in a text file and the way it is formatted, I can't figure out how to make the left side the X axis and right side the Y axis of a plot. There are hundreds of points so I can't reorganize all of them manually. Below is an example of the first few lines of the text file.

    -6.639705882353E+1 4.612014117183E-1
    -6.637867647059E+1 4.611021652616E-1
    -6.636029411765E+1 4.611021652616E-1
    -6.634191176471E+1 4.608038003887E-1
    -6.632352941176E+1 4.608038003887E-1

    Thanks for the help
  2. jcsd
  3. Oct 24, 2015 #2
    Never mind, I figured it out, I'll put the code below for anyone else to reference.

    load file.txt;
    x = file(:,1);
    y = file(:,2);
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - plot text file Date
Plot a stereographic hypercube in a Mac's Grapher.app? Yesterday at 8:22 AM
Mathematica Errors when plotting but not when evaluating Tuesday at 12:12 PM
Mathematica Color Contour Plots Mar 8, 2018
Text position in matlab plot Oct 20, 2015
Matlab: How to plot 'text' Oct 3, 2008