Frage

I am a newbie at matlab and I am trying to solve the following scenario.

I have large strings which need to be xor'ed essentially encoded in order to get a value. I am using the following code snippet to perform the operation :

 clear;clc;
 first ='abceeeeeeeeeeeeeeeddddddddddddd';
 second='defrrrrrrrrrrrrttttttttttttuuuu';
 result=bitxor(uint8(double(first)) , uint8(double(second)));

In the code above I am hard coding the value of the strings. I was wondering if matlab defines a size limit on the strings? If someone could help me to understand this value more in terms of bytes it will be very helpful.

Thanks and Regards, Bhavya

War es hilfreich?

Lösung

I don't think tere is a size limit attached to the variable, but there is certainly a limit in term of available memory which depends on your operating system and computer architecture.

For example, I run Matlab R2008b on a 32 bits Windows 7. The output of the command memory gives me:

Maximum possible array:            1128 MB (1.183e+009 bytes) *
Memory available for all arrays:   1470 MB (1.542e+009 bytes) **
Memory used by MATLAB:              294 MB (3.085e+008 bytes)
Physical Memory (RAM):             3519 MB (3.690e+009 bytes)
*  Limited by contiguous virtual address space available.
** Limited by virtual address space available.

I can create a character array of 5e8 elements before I raise an "out of memory" error, so that is 1e9 bytes, which is in agreement with the memory output.

You can check out the technical notes related to memory management on the MathWorks website:

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top