Memory / available storage space
5 views (last 30 days)
Show older comments
I have MATLAB installed on my D drive. If I run a MATLAB script that is located on my C drive, on which drive is memory used, C or D?
0 Comments
Answers (1)
Walter Roberson
on 14 Mar 2016
MATLAB does not itself use memory on disks. MATLAB checks the MATLAB path to find out where functions are and loads them from where-ever they are. If you have code that save()'s files or imwrite() or otherwise creates files, then they are created where-ever the path indicates; if no directory is specified then they are created in the current directory at the time of execution of the statement.
If you run out of RAM and your operating system is configured to swap to disk to extend the amount of storage space, then the location of the swap space is something you configure in the operating system, and is not under MATLAB's control. See https://www.winhelp.us/set-paging-file-to-a-fixed-size-in-windows.html
3 Comments
Guillaume
on 14 Mar 2016
No. You need to learn the difference between computer memory (RAM) and hard drive. arrays are allocated in the computer memory which has nothing to do with your hard drive.
Saying that, you're never going to be able to create an array of size 10^69. You'd have to use nearly every atom in the universe to store that many elements.
Walter Roberson
on 14 Mar 2016
The zeros() function is built in to MATLAB, hard-coded in the application, so it would be read from which-ever hard drive you had MATLAB installed on at the time you launch MATLAB. But the memory that is allocated is going to come from your RAM, not from a hard drive.
All Mathworks supplied executables and libraries and .m code and .p code, will be read off of the hard drive it is installed on, unless you have put another file with the same name somewhere else and have given the other file priority (even if accidentally.) But that has nothing to do with where memory is allocated from.
See Also
Categories
Find more on Introduction to Installation and Licensing 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!