Importing CSF file to matlab and accessing columns

5 ビュー (過去 30 日間)
HARI VEMURI
HARI VEMURI 2019 年 4 月 27 日
編集済み: Kojiro Saito 2019 年 4 月 30 日
I'm trying to do a spectral analysis of an ADC that I'm designing in CADENCE.
I have my output data in a CSV file(time and ouptut voltage). I tried to import the data into MATLAB using the csvread() command. But how to I access speciific columns in the CSV file
I will have to run an fft() on the voltage data. I have to access this column alone.

回答 (1 件)

Kojiro Saito
Kojiro Saito 2019 年 4 月 30 日
編集済み: Kojiro Saito 2019 年 4 月 30 日
Assume you have a following CSV file,
sample.csv
time,voltage
1,100
2,101
3,104
4,105
you can access to the specific column by specifying column number (data(:, colnum)). For example,
data = csvread('sample.csv', 1, 0);
f = fft(data(:,2));
csvread reads CSV file as matrix, but I would use readtable instead of csvread because it's much easier to access to specifc columns by using column names.
data = readtable('sample.csv');
f = fft(data.voltage);

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by