Matlab中字符串的最大大小 [英] maximum size of a string in matlab
问题描述
我是matlab的新手,正在尝试解决以下情况.
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)));
在上面的代码中,我正在对字符串的值进行硬编码.我想知道matlab是否在字符串上定义大小限制?如果有人可以帮助我更多地了解字节的值,那么它将非常有帮助.
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.
感谢和问候, 巴菲亚
推荐答案
我不认为tere是附加到变量的大小限制,但是可用内存方面肯定存在限制,具体取决于您的操作系统和计算机体系结构.
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.
例如,我在32位Windows 7上运行Matlab R2008b.命令memory
的输出显示给我:
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.
在引发内存不足"错误之前,我可以创建一个包含5e8个元素的字符数组,因此该错误数组为1e9个字节,与memory
输出一致.
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.
您可以在MathWorks网站上查看与内存管理相关的技术说明:
You can check out the technical notes related to memory management on the MathWorks website:
- Maximum Matrix Size by Platform
- Memory Management Guide
- Avoiding 'Out of Memory' Errors
这篇关于Matlab中字符串的最大大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!