How can I read the text file and plot the graph
Afficher commentaires plus anciens
clear;
close all;
clc;
fid = fopen(' ');
t = textscan (fid,'%f%f','Delimiter','\n');
fclose(fid);
x = t{1};
y = t{2};
figure(1)
plot(x,y,'.-')
grid
title('SNR aganist frequency')
xlabel('frequency')
ylabel('SNR')
Réponses (1)
Cris LaPierre
le 11 Déc 2018
0 votes
I have no idea what data from the file you are wanting to import, but textscan is not able on its out to figure out what 2 columns of floats you want to import. You need to provide more information that you have.
The 'HeaderLines' name-value pair might help, but because your data is interspersed with text sections intermittently, you are likely going to have to read the data in one line at a time (using fgetl) and first check that it is valid data before saving that line's data.
Catégories
En savoir plus sur Data Import and Export dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!