フィルターのクリア

unable to open .cdf file

2 ビュー (過去 30 日間)
Sonali
Sonali 2023 年 12 月 21 日
回答済み: Walter Roberson 2023 年 12 月 21 日
Hello, I am unable to open .cdf file. Even if it reads the file, it doesnot display all columns properly. And no column names are shown.
I was wondering if theres a better way of seeing the contents of .cdf file? Here's my code:
....................................................................................................................................................................................
files = dir('mvn_lpw_*.cdf');
num_files = length(files);
data= cell(1, num_files);
t= cell(1, num_files);
nam=files.name;
for j = 1:num_files
data{j}= cdfread(files(j).name);
end
data %displaying the data
...............................................................................................
heres a file:

採用された回答

Walter Roberson
Walter Roberson 2023 年 12 月 21 日
cdfread() does not preserve column names.
files = dir('mvn_lpw_*.cdf');
num_files = length(files);
data= cell(1, num_files);
t= cell(1, num_files);
nam=files.name;
for j = 1:num_files
thisfile = fullfile(files(j).folder, files(j).name);
vars = cdfinfo(thisfile).Variables(:,1);
data{j} = cell2table(cdfread(thisfile), 'VariableNames', vars);
end
data %displaying the data

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by