want to read 38 csv files only first and second column?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Sudhakar Shinde
2020-10-27
编辑:Sudhakar Shinde
2020-10-27
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 个评论
Sudhakar Shinde
2020-10-27
编辑:Sudhakar Shinde
2020-10-27
it was typing error.
use csvFile instead of csvFiles. Corrected in above code lines.
更多回答(1 个)
KSSV
2020-10-27
编辑:KSSV
2020-10-27
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 个评论
Sudhakar Shinde
2020-10-27
Name of csv file contains multiple dots , example: contours0.90.csv and looks like csvread producess error for this.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!