want to read 38 csv files only first and second column?
古いコメントを表示
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 日
readmatrix, csvread or readtable could help you to read csv file. For more specific if you could add example csv file data and the 48 csv filenames, hopefully names are in serial form ex. file1.csv ,file2.csv and so on.
muhammad choudhry
2020 年 10 月 27 日
編集済み: muhammad choudhry
2020 年 10 月 27 日
muhammad choudhry
2020 年 10 月 27 日
採用された回答
その他の回答 (1 件)
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 件のコメント
dpb
2020 年 10 月 27 日
If all is wanted/needed is the first two columns, may as well just write
data=data(:,1:2) ; % keep only first two columns
and not have duplicated/unwanted data hanging around...
muhammad choudhry
2020 年 10 月 27 日
Sudhakar Shinde
2020 年 10 月 27 日
Name of csv file contains multiple dots , example: contours0.90.csv and looks like csvread producess error for this.
KSSV
2020 年 10 月 27 日
There is a typo error..edited the code.....
カテゴリ
ヘルプ センター および File Exchange で Standard File Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!