MATLAB ヘルプ センター
ファイルセットに以前のファイルがあるかどうかを確認する
tf = hasPreviousFile(fs)
tf = hasPreviousFile(fs) は、fs で指定された FileSet オブジェクトで以前のファイルを処理できる場合、logical 1 (true) を返します。その他の場合は logical 0 (false) を返します。
fs
FileSet
1
true
0
false
例
すべて折りたたむ
ファイルセットの以前のファイルが処理可能であるかどうかを確認します。
ファイルの集合のファイルセット fs を作成します。
folder = {'accidents.mat','airlineResults.mat','census.mat','earth.mat'}
folder = 1×4 cell {'accidents.mat'} {'airlineResults.mat'} {'census.mat'} {'earth.mat'}
fs = matlab.io.datastore.FileSet(folder)
fs = FileSet with properties: NumFiles: 4 NumFilesRead: 0 FileInfo: Show FileInfo for all 4 files AlternateFileSystemRoots: {}
1 つ目のファイルに関する情報を取得し、内部ポインターを 1 ファイル前に移動します。
file1 = nextfile(fs)
file1 = 1×1 FileInfo Filename FileSize _________________________________________________________________________________________________________________ ________ "/mathworks/devel/bat/filer/batfs2566-0/Bdoc25b.2988451/build/runnable/matlab/toolbox/matlab/demos/accidents.mat" 7343
2 つ目のファイルに関する情報を取得し、内部のポインターを 1 ファイル前に移動します。
file2 = nextfile(fs)
file2 = 1×1 FileInfo Filename FileSize ______________________________________________________________________________ __________ "/tmp/Bdoc25b_2988451_1242027/tp0f1832b3/matlab-ex56196164/airlineResults.mat" 1.5042e+05
以前のファイルが存在するかどうかを確認します。この例では、以前のファイルが存在するため、結果は true です。
tf = logical 1
ファイルセット。FileSet オブジェクトとして指定します。FileSet オブジェクトを作成する場合は、matlab.io.datastore.FileSet を参照してください。
matlab.io.datastore.FileSet
R2020a で導入
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 のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
ヨーロッパ
アジア太平洋地域
最寄りの営業オフィスへのお問い合わせ