Load and plot data from txt file
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Good afternoon everyone,
I'm doing a research project where I have to create a GUI that allows you to open a .txt file and plot its contents. Here is my code so far:
%Opens file
[filename, pathname] = uigetfile('*.txt');
file = fullfile(pathname,filename);
S = load(file);
newfilename = (S(1:end-4));
x = newfilename(:,1);
y = newfilename(:,2);
plot(x,y);
For now I only have it specifically open the first 2 columns of data for convenience. This returns an empty plot. What am I doing wrong?
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 4 Juin 2013
Modifié(e) : Azzi Abdelmalek
le 4 Juin 2013
To read a txt file use
dlmread
textscan
fgetl
fscanf
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!