Asked by C Zeng
on 6 Jan 2013

Hi, all, I want to define and store a large scale arrays, like ones(3^N,1000,N) and N can be 15. However, matlab says it is out of memory, because of the large scale.

I wonder is there any way to resolve it? I mean, to fulfill the purpose but satisfy the requirement of matlab? Actually ones(3^N, 1000,1) is still very large scale.

Thanks.

Answer by Image Analyst
on 6 Jan 2013

Accepted Answer

Does it need to be double? Can it be single, uint8, or logical instead? Will it have any values other than 1 or small integers?

C Zeng
on 6 Jan 2013

Image Analyst
on 6 Jan 2013

C Zeng
on 6 Jan 2013

Log in to comment.

Answer by Matt J
on 6 Jan 2013

Edited by Matt J
on 6 Jan 2013

Are the entries mostly zeros? Could you use the SPARSE command?

If you need to work with n-dimensional sparse arrays, there is this:

http://www.mathworks.com/matlabcentral/fileexchange/29832-n-dimensional-sparse-arrays

C Zeng
on 6 Jan 2013

Thanks, will take a look. Unfortunately, entries may not be mostly zeros.

Matt J
on 6 Jan 2013

If they are mostly ones, you can express the array as

1 + sparse_array

and rewrite your computations in terms of that.

C Zeng
on 6 Jan 2013

Yes, could be helpful, let me find it out. Thanks.

Log in to comment.

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments

Log in to comment.