How can I read CSV file and plot without removing header?
64 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to read CSV file without removing header. The first row is the header. I tried with readtable but then I can not able to read the column as well. It is showing Invalid subscript error. I've attached the csv file and code in here.
A= dlmread('v1.csv'); %data read
freq= A(:,1); % it contains the frequency column
S11= A(:,2); % it contains S11 which is 2nd column
S21= A(:,3); % it contains S21 which is 3rd column
figure;
plot(freq,S11,'-','LineWidth',1.5,'color',[30,129,176]/255);
hold on;
plot(freq,S21,'-','LineWidth',1.5,'color',[215,74,31]/255);
0 commentaires
Réponse acceptée
Voss
le 30 Juin 2022
A = readtable('v1.csv')
figure;
plot(A{:,1},A{:,2},'-','LineWidth',1.5,'color',[30,129,176]/255);
hold on;
plot(A{:,1},A{:,3},'-','LineWidth',1.5,'color',[215,74,31]/255);
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets 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!