How do I properly import this text file and create a plot from it?
3 views (last 30 days)
Show older comments
Ravi Prathipati
on 29 Aug 2015
Answered: Ravi Prathipati
on 29 Aug 2015
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;
0 Comments
Accepted Answer
Walter Roberson
on 29 Aug 2015
I suspect that your current directory is not set to the directory that the file is in. Use the cd command to change current directory
1 Comment
Walter Roberson
on 29 Aug 2015
Also there is a possibility that there is a hidden file extension. What does
ls 0012*
show?
More Answers (1)
See Also
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!