I'm trying to convert a .pkl 4D array into a datastore on MATLAB

5 visualizaciones (últimos 30 días)
Hugh Easton
Hugh Easton el 25 de Jun. de 2021
Respondida: Ayush Modi el 23 de Mayo de 2024
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.'

Respuestas (1)

Ayush Modi
Ayush Modi el 23 de Mayo de 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:

Categorías

Más información sobre Classification en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by