How do I properly import this text file and create a plot from it?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ravi Prathipati
am 29 Aug. 2015
Beantwortet: Ravi Prathipati
am 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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 Kommentar
Walter Roberson
am 29 Aug. 2015
Also there is a possibility that there is a hidden file extension. What does
ls 0012*
show?
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu File Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!