progress
読み取ったファイルの割合
説明
は、データストアで読み取ったファイルの割合を、[0,1] の範囲で正規化した値として返します。fractionRead
= progress(sds
)
例
MATLAB® に MAT ファイルとして含まれているオーディオ信号セットへのパスを指定します。
folder = fullfile(matlabroot,"toolbox","matlab","audiovideo");
指定したフォルダーを示す信号データストアを作成し、サンプル レート変数の名前を Fs
に設定します。データストア内の MAT ファイルの名前をリストします。
sds = signalDatastore(folder, ... FileExtension=".mat",SampleRateVariableName="Fs"); [~,c] = fileparts(sds.Files)
c = 7×1 cell
{'chirp' }
{'gong' }
{'handel' }
{'laughter'}
{'mtlb' }
{'splat' }
{'train' }
信号データストアに読み取られていないファイルがある場合、連続したファイルをデータストアから読み取ります。関数 progress
を使用して、読み取られたファイルの割合を監視します。
while hasdata(sds) [data,info] = read(sds); fprintf("Fraction of files read: %.2f\n",progress(sds)) end
Fraction of files read: 0.14 Fraction of files read: 0.29 Fraction of files read: 0.43 Fraction of files read: 0.57 Fraction of files read: 0.71 Fraction of files read: 0.86 Fraction of files read: 1.00
関数 read
への最後の呼び出しで返された info
構造体を出力して精査します。
info
info = struct with fields:
SampleRate: 8192
TimeVariableName: "Fs"
SignalVariableNames: "y"
FileName: "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/audiovideo/train.mat"
入力引数
sds
を signalDatastore
オブジェクトとして指定します。
出力引数
読み取ったファイルの割合。[0,1] の範囲で正規化された値として返されます。
データ型: double
バージョン履歴
R2020a で導入
参考
signalDatastore
| preview
| readall
| read
| hasdata
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)