How to Arrange NDGRID and CELL data to become more compact in size and use less memory?

1 view (last 30 days)
If my question is not correct im sorry.because im still new in matlab.use matlab less than 1 month.
but i believe the expert guys will understood this question.im facing out of memory after run next code.
my laptop is 8gb RAM for your info.
matlab 64 bit.
%Create Combination
[a,b,c,d,e]=ndgrid(1:20,1:20,1:10,1:10,1:10);
data=[a(:),b(:),c(:),d(:),e(:)];
PV={'20 kinds of spec};
Batt={'20 kinds of spec};
MPPT={'10 kinds of spec};
Inverter={'10 kinds of spec};
DieselGenerator={'10 kinds of spec};
%Insert data into combination
ExpandData=[PV(data(:,1),:), Batt(data(:,2),:), MPPT(data(:,3),:), Inverter(data(:,4),:), DieselGenerator(data(:,5),:)]
Error as below :
Out of memory. Type HELP MEMORY for your options.
Error in Entahla (line 96)
Ireq_cc = 1.25.*Isc_stc.* Nparallel_PV; %equation 15
how to make above data consume more low memory or more faster code ?

Answers (1)

Matt J
Matt J on 1 May 2021
Shouldn't it be,
[a,b,c,d,e]=ndgrid(PV,Batt,MPPT,Inverter,DieselGenerator);
ExpandedData=[a(:),b(:),c(:),d(:),e(:)];
  3 Comments
Shahid Said
Shahid Said on 3 May 2021
After searching for few days I decided to stick with the current code and upgrade my laptop RAM.
Thanks for your support sir.

Sign in to comment.

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!