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);
    plot(x,y);
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to plot text file in MATLAB
Loading...