MATLAB How to plot text file in MATLAB

AI Thread Summary
A user encountered difficulties in plotting data from a network analyzer due to the formatting of a text file containing measurement values. The data points were structured with X values on the left and Y values on the right, but the user needed assistance in organizing them for plotting. After sharing a snippet of the text file, the user resolved the issue independently and provided a code snippet for others facing similar challenges. The solution involved loading the data file, extracting the X and Y values, and using a plotting function to visualize the standing wave pattern.
A.J.710
Messages
56
Reaction score
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
 
Physics news on Phys.org
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);
 
Back
Top