フィルターのクリア

Adding input arguments to datastore

1 回表示 (過去 30 日間)
Collin Tuttle
Collin Tuttle 2017 年 6 月 19 日
コメント済み: Collin Tuttle 2017 年 6 月 19 日
I am trying to use ncread in conjunction with a datastore, but I do not know how to add a variable name as an input argument. I've been trying this, but I can't figure out how to have it select a variable name. Thanks!
ds = datastore('filename.nc', 'Type', 'file', 'ReadFcn', @ncread);
T = tall(ds);

採用された回答

Steven Lord
Steven Lord 2017 年 6 月 19 日
varname = 'peaks';
myReadFcn = @(filename) ncread(filename, varname);
ds = datastore('example.nc', 'Type', 'file', 'ReadFcn', myReadFcn);
T = tall(ds);
You could of course combine those four lines into one, but I kept them as four separate lines to make it easier to understand each piece. This also assumes example.nc contains a variable named peaks.
  1 件のコメント
Collin Tuttle
Collin Tuttle 2017 年 6 月 19 日
Thank you!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by