How to create datastore from cell array containing a lot of data?

조회 수: 13 (최근 30일)
I am trying to run an LSTM code with a frequency domain input with a cell array that is 184 x 1 called freqNorm. Each cell is a vector array of size 1 x 100001. When I try to run my code I get the following error:
Requested 400x127x100001 (18.9GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive.
I read that I should create a datastore but I am not quite sure how to do this. The input data needs to still be in a 184 x 1 cell array. I tried using the following code, but i kept getting an error (as seen below the code).
save('freqNorm.mat','freqNorm');
freqNorm = datastore('C:\Users\Kim Cardillo\Desktop\Research\PRTools_Matlab\AEsignals_4to48kc_3.5-8mm\freqNorm.mat');
Error using datastore (line 125)
Cannot determine the datastore type for the specified location.
Specify the 'Type' name-value pair argument to indicate the type of datastore to create.
I am not quite sure what the 'Type' is nor do I know if what I am trying to do is correct. Can someone please help me.

채택된 답변

Devineni Aslesha
Devineni Aslesha 2020년 8월 24일
Hi Kimberly,
Please use the below code to create datastore from cell array freqNorm.
tA = tall(freqNorm);
write('C:\Users\Kim Cardillo\Desktop\Research\PRTools_Matlab\AEsignals_4to48kc_3.5-8mm\freqNorm.mat', tA);
tds = datastore('C:\Users\Kim Cardillo\Desktop\Research\PRTools_Matlab\AEsignals_4to48kc_3.5-8mm\freqNorm.mat','Type','tall');
For more information, refer the following links,
  댓글 수: 2
Kimberly Cardillo
Kimberly Cardillo 2020년 8월 26일
Thank you. When I ran the code you posted, I got this error:
Invalid write location: C:\Users\Kim Cardillo\Desktop\Research\PRTools_Matlab\AEsignals_4to48kc_3.5-8mm\freqNorm.mat
Folder must either be empty or non-existing.
What does that mean?
Devineni Aslesha
Devineni Aslesha 2020년 8월 27일
Hi Kimberly,
In the write doc, you can see that the location should be
  • Existing empty folder
  • New folder that write creates
In your case, freqNorm.mat should be empty if it is already existing.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by