How do I properly import this text file and create a plot from it?
Show older comments
Hello,
Hello, I am trying to import the values from a text file and create a plot from it. However, it is unable to read the txt file and when I check the variables, it shows the text file, but none of the variables. When I run the code, this shows up. Error using importdata (line 136) Unable to open file.
Error in 360_Hmk1 (line 5)
A1=importdata('0012data.txt',' ',2);"
I tried to convert my text file from a table to a cell array but this didn't work in that it didn't even show up as a variable. I appreciate your help. Thanks. Heres the code that I used:
if true
% code
end
%%Creating plot of airfoil cross section.
clear all;
% Import both data from txt. files
A1=importdata('0012data.txt',' ',2);
AF1x = A1.data(:,1);
AF1y = A1.data(:,2);
AF1Cp = A1.data(:,3);
plot(AF1x,AF1y,AF1Cp)
grid on;
Accepted Answer
More Answers (1)
Ravi Prathipati
on 29 Aug 2015
0 votes
Categories
Find more on File Operations 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!