I'm trying to convert a .pkl 4D array into a datastore on MATLAB
5 views (last 30 days)
Show older comments
I'm trying to convert a .pkl 4D array into a datastore on MATLAB, so that I can use the datastore to train a convolutional neural network. I have tried converting the .pkl file to a .mat, a .png and a .txt through python, but none have worked. When I try to convert the .mat file to the datastore using the code:
ds = datastore('folderpath', 'FileExtensions', '.mat', 'Type', 'tabularText')
I get the error "Cannot intepret data in the file 'filepath'. Found 3 variable names but 2 data columns. You may need to specifiy a different format, delimiter or number of lines.'
0 Comments
Answers (1)
Ayush Modi
on 23 May 2024
Hi Hugh,
The tabularText type is intended for reading tabular data from text files, which doesn't match the structure of .mat files containing 4D arrays. For .mat files, you should consider using a fileDatastore. Here is an example to show how you can achieve this:
fds = fileDatastore('filename',"ReadFcn",@load,"FileExtensions",".mat");
data1 = read(fds);
For more information on fileDatastore function, refer to the following MathWorks documentation:
0 Comments
See Also
Categories
Find more on Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!