回答 (1 件)

Ayush Laddha
Ayush Laddha 2020 年 6 月 19 日

0 投票

I understand that you wish to shuffle the fileDatastore. You can utilize the shuffle function to do so. You can use it as given below –
fs = fileDatastore(path, 'ReadFcn', @load)
shuffled_fs = shuffle(fs)
Link to its documentation –

4 件のコメント

Haoqing Li
Haoqing Li 2020 年 6 月 19 日
編集済み: dpb 2020 年 7 月 14 日
Hi,
It doesn't work, below is my result:
>>fs = fileDatastore('try', 'ReadFcn', @load )
fs =
FileDatastore with properties:
Files: {
'D:\Google Drive\MultiLayerPerceptron\try\output.mat';
'D:\Google Drive\MultiLayerPerceptron\try\output1.mat';
'D:\Google Drive\MultiLayerPerceptron\try\output2.mat'
}
Folders: {
'D:\Google Drive\MultiLayerPerceptron\try'
}
UniformRead: 0
ReadMode: 'file'
BlockSize: Inf
PreviewFcn: @load
SupportedOutputFormats: ["txt" "csv" "xlsx" "xls" "parquet" "parq" "png" "jpg" "jpeg" "tif" "tiff" "wav" "flac" "ogg" "mp4" "m4a"]
ReadFcn: @load
AlternateFileSystemRoots: {}
>> shuffled_fs = shuffle(fs);
Check for missing argument or incorrect argument data type in call to function 'shuffle'.
>> dsrand = isShuffleable(fs)
dsrand =
logical
0
It shows that the filedatastore is not shuffleable, is there any way to make it shuffeable?
Ayush Laddha
Ayush Laddha 2020 年 6 月 22 日
Hi,
It works perfectly fine for me. I am not able to reproduce the issue you are facing. It would be great if you could provide more info about the MATLAB version you are using?
Haoqing Li
Haoqing Li 2020 年 7 月 1 日
Hi,
I'm using 2020a.
dpb
dpb 2020 年 7 月 14 日
I get same error on R2019b as does Haoqing LI (another poster just asked same Q? and this thread showed up in the automated links system so came to investigate).
Dunno' what is different w/ the release Ayush Laddha used, but
>> ds=fileDatastore('3*.xlsx','ReadFcn',@readtable)
ds =
FileDatastore with properties:
Files: {
'C:\Users\...\Documents\MATLAB\Work\3-15-17.xlsx';
'C:\Users\...\Documents\MATLAB\Work\3-16-17.xlsx';
'C:\Users\...\Documents\MATLAB\Work\3-17-17.xlsx'
}
UniformRead: 0
ReadMode: 'file'
BlockSize: Inf
PreviewFcn: @readtable
ReadFcn: @readtable
AlternateFileSystemRoots: {}
>> ds=shuffle(ds)
Undefined function 'shuffle' for input arguments of type 'matlab.io.datastore.FileDatastore'.
>>

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

質問済み:

2020 年 6 月 18 日

コメント済み:

dpb
2020 年 7 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by