I'm trying to convert a .pkl 4D array into a datastore on MATLAB
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Ayush Modi
2024년 5월 23일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!