MATLAB Answers

want to read 38 csv files only first and second column?

2 views (last 30 days)
Hi,
I want to read first and second coloumn of the 48 .csv files then plot the data from them coloumns. Once data plotted seaparately then want to apply the circle algoritham to it which will give me the estimated radius of the circle in list or array then I want to plot them against time?
Can you guys help I do not know how to read column 1 and 2 of them 48 files?
  3 Comments
muhammad choudhry
muhammad choudhry on 27 Oct 2020
and this a algoritham code which will then applied to find the radius of the circle I can do manually one by one but that's not a goal.

Sign in to comment.

Accepted Answer

Sudhakar Shinde
Sudhakar Shinde on 27 Oct 2020
Edited: Sudhakar Shinde on 27 Oct 2020
csvFile = dir("*.csv") ;
N = length(csvFile) ;
for i = 1:N
data = readtable(csvFile(i).name) ;
iwant = data.Points_0;
iwant1 = data.Points_1;
% do what you want
end
  2 Comments
Sudhakar Shinde
Sudhakar Shinde on 27 Oct 2020
it was typing error.
use csvFile instead of csvFiles. Corrected in above code lines.

Sign in to comment.

More Answers (1)

KSSV
KSSV on 27 Oct 2020
Edited: KSSV on 27 Oct 2020
csvFiles = dir("*.csv") ;
N = length(csvFiles) ;
for i = 1:N
data = csvread(csvFiles(i).name) ; % also read about xlsread
iwant = data(:,1:2) ; % read first two columns
% do what you want
end
  4 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!