How can I read CSV file and plot without removing header?
73 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Voss
on 30 Jun 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);
More Answers (0)
See Also
Categories
Find more on Spreadsheets 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!