what is the maximum dimension size we can generate by rand function?
    5 views (last 30 days)
  
       Show older comments
    
as i want generate random matrices using rand fun eg. rand(m,n) what is maximum size of m & n i can use?
0 Comments
Answers (2)
  Azzi Abdelmalek
      
      
 on 19 Jul 2016
        
      Edited: Azzi Abdelmalek
      
      
 on 19 Jul 2016
  
      Type
memory
you will get Maximum possible array
a=rand
 whos a
  Name      Size            Bytes  Class     Attributes
a         1x1                 8  double
this indicate that a is 8 bytes. you can deduce the maximum size of your array
1 Comment
  Guillaume
      
      
 on 19 Jul 2016
				Yes, the maximum array size (generated by rand or any other way) is limited by your computer memory.
If you're using a 64-bit version of matlab, an array of the maximum possible size would probably take a loooong time to generate and do any operation with.
  Steven Lord
    
      
 on 19 Jul 2016
        There's a theoretical limit that you're only likely to hit if you're using an older 32-bit version of MATLAB. This is given by the second output of the computer function. [If you're on a 64-bit machine, I feel very confident saying you don't have a machine with enough memory to create a matrix that size. I think you'd need somewhere in the hundreds or thousands of terabytes.]
There's a practical limit given by the amount of memory available to MATLAB. This can be somewhat controlled by having other applications open or (if you're using release R2015a or later) via the Array Size Limit preference in the Workspace Browser section of the Preferences for MATLAB.
And then there's the limit of how many random numbers you need for your particular application.
0 Comments
See Also
Categories
				Find more on Creating and Concatenating Matrices in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!