ヘルプ センターヘルプ センター
データが読み取り可能かどうかを判別
tf = hasdata(ds)
例
tf = hasdata(ds)は、dsで指定されたデータ ストアに読み取り可能なデータがある場合に logical1(true) を返します。その他の場合は logical0(false) を返します。
ds
1
true
0
false
すべて折りたたむ
関数mapreduceの出力ファイルであるサンプル ファイルmapredout.matからデータ ストアを作成します。
mapreduce
mapredout.mat
ds = datastore('mapredout.mat');
読み取り可能なデータがなくなるまで、データ ストアのデータを読み取ります。
whilehasdata(ds) T = read(ds);end
入力データ ストア。次のデータ ストアをhasdataメソッドの入力として使用できます。
hasdata
MATLAB®データ ストア — MATLAB数据存储関数を使用して作成されたデータ ストア。たとえば、ImageDatastoreを使用して、イメージの集合用のデータ ストアを作成します。データ ストアの完全な一覧は、ファイル形式またはアプリケーション用のデータ ストアの選択を参照してください。
数据存储
ImageDatastore
統合または変換を行ったデータ ストア — 関数combineおよびtransformを使用して作成したデータ ストア。
combine
transform
カスタム データ ストア — カスタム データ ストア フレームワークを使用して作成したデータ ストア。カスタム データ ストアの開発を参照してください。
backgroundPool
ThreadPool
使用上の注意事項および制限事項:
スレッドベースの環境では、次のデータストアでのみhasdataを使用できます。
ImageDatastoreオブジェクト
combineまたはtransformを使用してImageDatastoreオブジェクトから作成するCombinedDatastoreまたはTransformedDatastoreオブジェクト
CombinedDatastore
TransformedDatastore
Parallel Computing Toolbox™ がある場合は、他のデータストアでhasdataを使用できます。これを行うには、backgroundPoolまたはThreadPoolを使用する代わりに、プロセスベースの並列プールを使用して関数を実行します (ProcessPoolまたはClusterPoolを使用します)。
ProcessPool
ClusterPool
詳細については、Run MATLAB Functions in Thread-Based Environmentを参照してください。
この例の変更されたバージョンがあります。編集された方の例を開きますか?
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office